libeplayer3/container_ffmpeg: mutex fix

This commit is contained in:
martii
2013-08-16 14:33:30 +02:00
parent 672b5d10d2
commit 093862d85d

View File

@@ -861,11 +861,8 @@ int container_ffmpeg_init(Context_t *context, char * filename)
ffmpeg_printf(10, "filename %s\n", filename); ffmpeg_printf(10, "filename %s\n", filename);
getMutex(FILENAME, __FUNCTION__,__LINE__);
if (isContainerRunning) { if (isContainerRunning) {
ffmpeg_err("ups already running?\n"); ffmpeg_err("ups already running?\n");
releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_RUNNING; return cERR_CONTAINER_FFMPEG_RUNNING;
} }
@@ -887,7 +884,6 @@ int container_ffmpeg_init(Context_t *context, char * filename)
av_strerror(err, error, 512); av_strerror(err, error, 512);
ffmpeg_err("Cause: %s\n", error); ffmpeg_err("Cause: %s\n", error);
releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_OPEN; return cERR_CONTAINER_FFMPEG_OPEN;
} }
@@ -909,7 +905,6 @@ int container_ffmpeg_init(Context_t *context, char * filename)
//for buffered io //for buffered io
ffmpeg_buf_free(); ffmpeg_buf_free();
//for buffered io (end) //for buffered io (end)
releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_STREAM; return cERR_CONTAINER_FFMPEG_STREAM;
#endif #endif
} }
@@ -949,6 +944,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
if (teletextTrack) if (teletextTrack)
teletextId = ((AVStream *) (teletextTrack->stream))->id; teletextId = ((AVStream *) (teletextTrack->stream))->id;
getMutex(FILENAME, __FUNCTION__,__LINE__);
if (context->manager->video) if (context->manager->video)
context->manager->video->Command(context, MANAGER_DEL, NULL); context->manager->video->Command(context, MANAGER_DEL, NULL);
if (context->manager->audio) if (context->manager->audio)
@@ -961,8 +957,8 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL); context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL);
if (context->manager->teletext) if (context->manager->teletext)
context->manager->teletext->Command(context, MANAGER_DEL, NULL); context->manager->teletext->Command(context, MANAGER_DEL, NULL);
ffmpeg_printf(20, "dump format\n");
ffmpeg_printf(20, "dump format\n");
av_dump_format(avContext, 0, filename, 0); av_dump_format(avContext, 0, filename, 0);
ffmpeg_printf(1, "number streams %d\n", avContext->nb_streams); ffmpeg_printf(1, "number streams %d\n", avContext->nb_streams);
@@ -1344,14 +1340,16 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
} /* for */ } /* for */
if (audioId > -1 && context->playback) if (context->playback) {
context->playback->Command(context, PLAYBACK_SWITCH_AUDIO, &audioId); if (audioId > -1)
if (subtitleId > -1 && context->playback) context->playback->Command(context, PLAYBACK_SWITCH_AUDIO, &audioId);
context->playback->Command(context, PLAYBACK_SWITCH_SUBTITLE, &subtitleId); if (subtitleId > -1)
if (dvbsubtitleId > -1 && context->playback) context->playback->Command(context, PLAYBACK_SWITCH_SUBTITLE, &subtitleId);
context->playback->Command(context, PLAYBACK_SWITCH_DVBSUBTITLE, &dvbsubtitleId); if (dvbsubtitleId > -1)
if (teletextId > -1 && context->playback) context->playback->Command(context, PLAYBACK_SWITCH_DVBSUBTITLE, &dvbsubtitleId);
context->playback->Command(context, PLAYBACK_SWITCH_TELETEXT, &teletextId); if (teletextId > -1)
context->playback->Command(context, PLAYBACK_SWITCH_TELETEXT, &teletextId);
}
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);