libeplayer3: minor changes

This commit is contained in:
martii
2013-07-07 15:59:55 +02:00
parent f97060bcd6
commit e80f8646e7
3 changed files with 19 additions and 9 deletions

View File

@@ -728,6 +728,9 @@ static void FFMPEGThread(Context_t *context) {
if (context->output->audio->Write(context, &avOut) < 0)
ffmpeg_err("writing data to audio device failed\n");
av_freep(&output);
#ifdef USE_LIBSWRESAMPLE
currentAudioPts = pts = swr_next_pts(swr, INT64_MIN);
#endif
}
}
else if (audioTrack->have_aacheader == 1)
@@ -1681,8 +1684,8 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
return cERR_CONTAINER_FFMPEG_ERR;
}
context->output->Command(context, OUTPUT_FLUSH, NULL); // martii
context->output->Command(context, OUTPUT_PLAY, NULL); // martii
context->output->Command(context, OUTPUT_FLUSH, NULL);
context->output->Command(context, OUTPUT_PLAY, NULL);
latestPts = 0;
#if 1
if (videoTrack && videoTrack->stream && ((AVStream*) videoTrack->stream)->codec && ((AVStream*) videoTrack->stream)->codec->codec)
@@ -1800,8 +1803,8 @@ static int container_ffmpeg_seek(Context_t *context, float sec, int absolute) {
return cERR_CONTAINER_FFMPEG_ERR;
}
context->output->Command(context, OUTPUT_FLUSH, NULL); // martii
context->output->Command(context, OUTPUT_PLAY, NULL); // martii
context->output->Command(context, OUTPUT_FLUSH, NULL);
context->output->Command(context, OUTPUT_PLAY, NULL);
latestPts = 0;
#if 1
if (videoTrack && videoTrack->stream && ((AVStream*) videoTrack->stream)->codec && ((AVStream*) videoTrack->stream)->codec->codec)

View File

@@ -163,7 +163,12 @@ status = 1;
/* Functions */
/* ***************************** */
static int PlaybackStop(Context_t *context);
static int PlaybackOpen(Context_t *context, char * uri) {
if (context->playback->isPlaying)
PlaybackStop(context);
playback_printf(10, "URI=%s\n", uri);
context->playback->uri = strdup(uri);
@@ -311,7 +316,8 @@ static int PlaybackOpen(Context_t *context, char * uri) {
}
else
{
playback_err("playback alread running\n");
playback_err("playback already running\n");
return cERR_PLAYBACK_ERROR;
}
@@ -488,7 +494,7 @@ static int PlaybackStop(Context_t *context) {
playback_printf(10, "\n");
if (context->playback->isPlaying) {
if (context && context->playback && context->playback->isPlaying) {
context->playback->isPaused = 0;
context->playback->isPlaying = 0;

View File

@@ -267,12 +267,13 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
bool cPlayback::Stop(void)
{
printf("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing);
if(playing==false) return false;
//if(playing==false) return false;
if(player && player->playback && player->output) {
if(player && player->playback)
player->playback->Command(player, PLAYBACK_STOP, NULL);
if(player && player->output)
player->output->Command(player, OUTPUT_CLOSE, NULL);
}
if(player && player->output) {
player->output->Command(player,OUTPUT_DEL, (void*)"audio");