[FFmpeg-soc] [RFC] How to pass frames to buffer source filter (was: r3760 - in libavfilter: Makefile allfilters.c diffs/02_ffmpeg_filters.diff vsrc_buffer.c vsrc_buffer.h)

Vitor Sessak vitor1001 at gmail.com
Wed Oct 8 20:53:15 CEST 2008


Aurelien Jacobs escreveu:
> vitor wrote:
> 
>> Author: vitor
>> Date: Wed Oct  8 20:11:13 2008
>> New Revision: 3760
>>
>> Log:
>> Create a buffer source filter instead of duplicating it in ffmpeg.c and 
>> ffplay.c
>>
>> [...]
>>
>>  Index: ffmpeg.c
>>  ===================================================================
>> ---- ffmpeg.c	(revision 15000)
>> +--- ffmpeg.c	(revision 15585)
>>  +++ ffmpeg.c	(working copy)
>> -@@ -41,6 +41,12 @@
>> +@@ -41,6 +41,13 @@
>>   #include "libavutil/avstring.h"
>>   #include "libavformat/os_support.h"
>>   
>> @@ -10,12 +10,13 @@ Index: ffmpeg.c
>>  +# include "libavfilter/avfilter.h"
>>  +# include "libavfilter/avfiltergraph.h"
>>  +# include "libavfilter/graphparser.h"
>> ++# include "libavfilter/vsrc_buffer.h"
> 
> As long as this header is not public, ffmpeg shouldn't rely on it.

This is related to your comment below...

>> [...]
>>
>>  +#if ENABLE_AVFILTER
>>  +        if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO) {
>>  +            // add it to be filtered
>> -+            memcpy(ist->filter_frame->data,  picture.data,
>> -+                   sizeof(picture.data));
>> -+            memcpy(ist->filter_frame->linesize, picture.linesize,
>> -+                   sizeof(picture.linesize));
>> -+            ist->has_filter_frame = 1;
>> ++            av_vsrc_buffer_add_frame(ist->input_video_filter, &picture,
>> ++                                     ist->pts,
>> ++                                     ist->st->codec->sample_aspect_ratio);
>>  +        }
>>  +#endif
> 
> Direct call to a function inside a particular filter is quite ugly.
> I have not looked at this more deeply, so I don't know if there is any
> better solution, but avoiding such direct call to filter internals
> would be nice if possible.

Indeed, but I didn't found a cleaner way to do it. Suggestions welcome...

-Vitor



More information about the FFmpeg-soc mailing list