[FFmpeg-devel] Issue an error when forced format cannot be honnored

Michael Niedermayer michaelni
Mon Oct 26 18:58:10 CET 2009


On Sun, Oct 25, 2009 at 12:11:05AM +0200, Etienne Buira wrote:
> Hi.
> 
> The trouble with current version is if I specify:
> ffmpeg -i input.avi -acodec copy -vcodec copy -f mpegtsraw output.mpeg
> 
> mpegtsraw being a valid demuxer, no error is issued, and the output file
> ends up being mpeg without notice.
> 
> The attached patch makes ffmpeg issue an error if -f option cannot be
> met.
> 
> Regards.

>  ffmpeg.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 190fd4a59654aa24209f89d91a92102120c8b3f0  ffmpeg_enforce_-f_to_behave_as_expected.diff
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 20357)
> +++ ffmpeg.c	(working copy)
> @@ -111,6 +111,7 @@
>  
>  static AVInputFormat *file_iformat;
>  static AVOutputFormat *file_oformat;
> +static int forced_format = 0;
>  static int frame_width  = 0;
>  static int frame_height = 0;
>  static float frame_aspect_ratio = 0;

static void *invalid_format= (void*)1;


> @@ -2386,6 +2387,7 @@
>  
>      file_iformat = av_find_input_format(arg);
>      file_oformat = guess_format(arg, NULL, NULL);
> +    forced_format = 1;

if(!file_oformat)
    file_oformat= invalid_format;


above is a slightly cleaner variant alternatively maybe the actual string
could be stored and the format searched when the in/out is clearer
there are probably other options but keeping a second variable
(forced_format) in sync seems a little fragile to me


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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091026/3a054e6c/attachment.pgp>



More information about the ffmpeg-devel mailing list