[MPlayer-dev-eng] [PATCH] list lavf output formats with format=help

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Feb 12 19:32:25 CET 2007


Hello,
does it look okay?
It moves the av_register_all up because IMO it would be better to have
the "help" check before the i_certify_... etc. stuff...

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/muxer_lavf.c
===================================================================
--- libmpdemux/muxer_lavf.c	(revision 22211)
+++ libmpdemux/muxer_lavf.c	(working copy)
@@ -322,6 +322,13 @@
 	av_free(priv->oc);
 }
 
+static void list_formats(void) {
+	AVOutputFormat *fmt;
+	mp_msg(MSGT_DEMUX, MSGL_INFO, "Available lavf output formats:\n");
+	for (fmt = first_oformat; fmt; fmt = fmt->next)
+		mp_msg(MSGT_DEMUX, MSGL_INFO, "%15s : %s\n", fmt->name, fmt->long_name);
+}
+
 extern char *out_filename;
 int muxer_init_muxer_lavf(muxer_t *muxer)
 {
@@ -329,6 +336,13 @@
 	AVOutputFormat *fmt = NULL;
 	char mp_filename[256] = "menc://stream.dummy";
 
+	av_register_all();
+
+	if (strcmp(conf_format, "help") == 0) {
+		list_formats();
+		return 0;
+	}
+
 	mp_msg(MSGT_MUXER, MSGL_WARN, "** MUXER_LAVF *****************************************************************\n");
 	if (!conf_allow_lavf) {
 		mp_msg(MSGT_MUXER, MSGL_FATAL,
@@ -351,8 +365,6 @@
 	if(priv == NULL)
 		return 0;
 
-	av_register_all();
-	
 	priv->oc = av_alloc_format_context();
 	if(!priv->oc) 
 	{


More information about the MPlayer-dev-eng mailing list