libeplayer3: add callback to abort avformat_open_input

Origin commit data
------------------
Branch: master
Commit: d02696233c
Author: martii <m4rtii@gmx.de>
Date: 2013-03-10 (Sun, 10 Mar 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-03-10 15:44:30 +01:00
parent c992bd376c
commit 4e9f1ff475
5 changed files with 22 additions and 0 deletions

View File

@@ -1508,6 +1508,13 @@ static void ffmpeg_buf_free()
/* **************************** */ /* **************************** */
/* Container part for ffmpeg */ /* Container part for ffmpeg */
/* **************************** */ /* **************************** */
#ifdef MARTII
static int interrupt_cb(void *ctx)
{
PlaybackHandler_t *p = (PlaybackHandler_t *)ctx;
return p->abortRequested;
}
#endif
int container_ffmpeg_init(Context_t *context, char * filename) int container_ffmpeg_init(Context_t *context, char * filename)
{ {
@@ -1543,6 +1550,12 @@ int container_ffmpeg_init(Context_t *context, char * filename)
#ifdef MARTII //TDT #ifdef MARTII //TDT
avformat_network_init(); avformat_network_init();
#endif #endif
#ifdef MARTII
context->playback->abortRequested = 0;
avContext = avformat_alloc_context();
avContext->interrupt_callback.callback = interrupt_cb;
avContext->interrupt_callback.opaque = context->playback;
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) { if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) {
@@ -2139,6 +2152,7 @@ static int container_ffmpeg_stop(Context_t *context) {
getMutex(FILENAME, __FUNCTION__,__LINE__); getMutex(FILENAME, __FUNCTION__,__LINE__);
#ifdef MARTII #ifdef MARTII
if (avContext)
avformat_close_input(&avContext); avformat_close_input(&avContext);
#else #else
if (avContext != NULL) { if (avContext != NULL) {

View File

@@ -35,6 +35,7 @@ typedef struct PlaybackHandler_s {
unsigned char isDvbSubtitle; unsigned char isDvbSubtitle;
unsigned char isTeletext; unsigned char isTeletext;
unsigned char mayWriteToFramebuffer; unsigned char mayWriteToFramebuffer;
unsigned char abortRequested;
#endif #endif
int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *); int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *);

View File

@@ -1172,6 +1172,7 @@ PlaybackHandler_t PlaybackHandler = {
0, 0,
0, 0,
1, 1,
0,
#endif #endif
&Command, &Command,
"", "",

View File

@@ -655,6 +655,11 @@ void cPlayback::SuspendSubtitle(bool b)
else else
player->playback->Command(player, PLAYBACK_FRAMEBUFFER_UNLOCK, 0); player->playback->Command(player, PLAYBACK_FRAMEBUFFER_UNLOCK, 0);
} }
void cPlayback::RequestAbort() {
if (player->playback)
player->playback->abortRequested = 1;
}
#endif #endif
#if 0 #if 0
bool cPlayback::IsPlaying(void) const bool cPlayback::IsPlaying(void) const

View File

@@ -53,6 +53,7 @@ class cPlayback
#ifdef MARTII #ifdef MARTII
void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void RequestAbort(void);
#endif #endif
#if 0 #if 0
// Functions that are not used by movieplayer.cpp: // Functions that are not used by movieplayer.cpp: