[Ffmpeg-devel] [PATCH] split av_encode function and do related reorder

Michael Niedermayer michaelni
Mon Feb 26 15:40:19 CET 2007


Hi

On Mon, Feb 26, 2007 at 07:55:09PM +0800, Limin Wang wrote:
> Hi,
> 
> The attached patch try to cleanup ffmpeg.c av_encode function, I have pass
> "make test" test. Please have review and give your comments. I don't know
> whether ffmpeg developer like big function?
> 
> I feel it has too many lines code and too difficult to maintain and develop.
> So I split it into three functions:
> av_transcode_init(): ffmpeg transcode initialization
> av_transcode_start(): main loop of file transcode
> av_transcode_close(): ffmpeg transcode close, including resource/mem release,
> the memory release order is first allocate(in av_transcode_init), last release.
> 
> If the patch is OK, I'll split av_transcode_init() into more functions for it's
> too big still.

[...]

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 8129)
> +++ ffmpeg.c	(working copy)
> @@ -277,6 +277,14 @@
>      int nb_streams;       /* nb streams we are aware of */
>  } AVInputFile;
>  
> +typedef struct AVTranscodeContext {
> +    AVOutputStream **ost_table;
> +    AVInputStream **ist_table;
> +    AVInputFile *file_table;
> +    int nb_istreams;
> +    int nb_ostreams;
> +} AVTranscodeContext;

i see no sense in this struct the variables should stay globals as they are
global to the process, moving them into a struct just makes it harder to
access them

also adding such a struct must be in a seperate patch and commit from
other unrelated changes like spliting av_encode()

spliting av_encode() certainly is welcome, but a patch doing so should
be quite small and rather look like:

-av_encode(){
+av_encode_init(){
...
+}
+av_encode_main(){
...
+}
+av_encode_close(){


+av_encode(){
+   av_encode_init();
+   av_encode_main();
+   av_encode_close();
+}

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070226/4e898e1a/attachment.pgp>



More information about the ffmpeg-devel mailing list