]> git.sesse.net Git - mlt/blobdiff - src/modules/avformat/consumer_avformat.c
check result of header write
[mlt] / src / modules / avformat / consumer_avformat.c
index 367d8aaad0c2979682aa0e4d60a0606162a4b8a2..8776de886f43e90288b7725cf082865f1456a6fa 100644 (file)
@@ -1238,7 +1238,7 @@ static void *consumer_thread( void *arg )
        if ( filename == NULL || !strcmp( filename, "" ) )
                filename = "pipe:";
 
-#if LIBAVUTIL_VERSION_INT >= ((53<<16)+(2<<8)+0)
+#if defined(FFUDIV) && LIBAVUTIL_VERSION_INT >= ((53<<16)+(2<<8)+0)
        avformat_alloc_output_context2( &oc, fmt, format, filename );
 #else
        oc = avformat_alloc_context( );
@@ -1474,10 +1474,15 @@ static void *consumer_thread( void *arg )
                // Write the stream header.
                if ( mlt_properties_get_int( properties, "running" ) )
 #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
-                       avformat_write_header( oc, NULL );
+                       if ( avformat_write_header( oc, NULL ) < 0 )
 #else
-                       av_write_header( oc );
+                       if ( av_write_header( oc ) < 0 )
 #endif
+                       {
+                               mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), "Could not write header '%s'\n", filename );
+                               mlt_events_fire( properties, "consumer-fatal-error", NULL );
+                               goto on_fatal_error;
+                       }
        }
 #if LIBAVFORMAT_VERSION_INT < ((53<<16)+(2<<8)+0)
        else