diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index c7e0a9a..20c55ac 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -388,6 +388,8 @@ static void FFMPEGThread(Context_t * context) avOut.width = videoTrack->width; avOut.height = videoTrack->height; avOut.type = "video"; + avOut.stream = videoTrack->stream; + avOut.avfc = avContext; if (context->output->video->Write(context, &avOut) < 0) { ffmpeg_err("writing data to video device failed\n"); @@ -416,6 +418,8 @@ static void FFMPEGThread(Context_t * context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; + avOut.stream = audioTrack->stream; + avOut.avfc = avContext; if (context->output->audio->Write(context, &avOut) < 0) ffmpeg_err("(raw pcm) writing data to audio device failed\n"); @@ -541,6 +545,8 @@ static void FFMPEGThread(Context_t * context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; + avOut.stream = audioTrack->stream; + avOut.avfc = avContext; if (context->output->audio->Write(context, &avOut) < 0) ffmpeg_err("writing data to audio device failed\n"); @@ -560,6 +566,8 @@ static void FFMPEGThread(Context_t * context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; + avOut.stream = audioTrack->stream; + avOut.avfc = avContext; if (context->output->audio->Write(context, &avOut) < 0) ffmpeg_err("(aac) writing data to audio device failed\n"); @@ -575,6 +583,8 @@ static void FFMPEGThread(Context_t * context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; + avOut.stream = audioTrack->stream; + avOut.avfc = avContext; if (context->output->audio->Write(context, &avOut) < 0) ffmpeg_err("writing data to audio device failed\n"); @@ -890,6 +900,9 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename) */ memset(&track, 0, sizeof(track)); + track.avfc = avContext; + track.stream = stream; + switch (stream->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", stream->codec->codec_type); @@ -937,7 +950,7 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename) track.Name = "und"; track.Encoding = encoding; - track.stream = stream; + track.avfc = avContext; track.Id = stream->id; if (stream->duration == AV_NOPTS_VALUE) { @@ -971,7 +984,6 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename) ffmpeg_printf(10, "Language %s\n", track.Name); track.Encoding = encoding; - track.stream = stream; track.Id = stream->id; track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0; #if 0 @@ -1160,7 +1172,6 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename) ffmpeg_printf(10, "Language %s\n", track.Name); track.Encoding = encoding; - track.stream = stream; track.Id = stream->id; track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0; diff --git a/libeplayer3/include/manager.h b/libeplayer3/include/manager.h index 292d67b..98f9a73 100644 --- a/libeplayer3/include/manager.h +++ b/libeplayer3/include/manager.h @@ -49,6 +49,8 @@ typedef struct Track_s { int width; int height; + /* context from ffmpeg */ + AVFormatContext *avfc; /* stream from ffmpeg */ AVStream *stream; /* codec extra data (header or some other stuff) */ diff --git a/libeplayer3/include/output.h b/libeplayer3/include/output.h index ea7e9ce..93ee660 100644 --- a/libeplayer3/include/output.h +++ b/libeplayer3/include/output.h @@ -4,6 +4,12 @@ #include #include +#include +#include +#include +#include +#include + typedef enum { OUTPUT_INIT, OUTPUT_ADD, @@ -44,6 +50,11 @@ typedef struct { unsigned int height; char *type; + + /* context from ffmpeg */ + AVFormatContext *avfc; + /* stream from ffmpeg */ + AVStream *stream; } AudioVideoOut_t; struct Context_s; diff --git a/libeplayer3/include/writer.h b/libeplayer3/include/writer.h index 4892f60..af2b9bf 100644 --- a/libeplayer3/include/writer.h +++ b/libeplayer3/include/writer.h @@ -4,6 +4,12 @@ #include #include +#include +#include +#include +#include +#include + typedef enum { eNone, eAudio, eVideo, eGfx } eWriterType_t; typedef struct { @@ -18,6 +24,10 @@ typedef struct { unsigned int Width; unsigned int Height; unsigned char Version; + /* context from ffmpeg */ + AVFormatContext *avfc; + /* stream from ffmpeg */ + AVStream *stream; } WriterAVCallData_t; typedef struct WriterCaps_s { diff --git a/libeplayer3/output/linuxdvb.c b/libeplayer3/output/linuxdvb.c index 09f05e9..c318278 100644 --- a/libeplayer3/output/linuxdvb.c +++ b/libeplayer3/output/linuxdvb.c @@ -902,6 +902,8 @@ static int Write(Context_t *context, AudioVideoOut_t *out) unsigned char audio = 0; Writer_t *writer; WriterAVCallData_t call; + call.stream = out->stream; + call.avfc = out->avfc; if (out == NULL) { linuxdvb_err("null pointer passed\n");