@@ -608,7 +608,7 @@ static void event_ffmpeg_newfile(struct context *cnt,
608608 unsigned char * convbuf , * y , * u , * v ;
609609 char stamp [PATH_MAX ];
610610 const char * moviepath ;
611- char codec [ 8 ] ;
611+ const char * codec ;
612612 long codenbr ;
613613
614614 if (!cnt -> conf .ffmpeg_output && !cnt -> conf .ffmpeg_output_debug )
@@ -629,46 +629,50 @@ static void event_ffmpeg_newfile(struct context *cnt,
629629 * motion movies get the same name as normal movies plus an appended 'm'
630630 * PATH_MAX - 4 to allow for .mpg to be appended without overflow
631631 */
632- /* Set up a testing / evaluation codec which will use a different
633- * codec for the events.
632+
633+ /* The following section allows for testing of all the various containers
634+ * that Motion permits. The container type is pre-pended to the name of the
635+ * file so that we can determine which container type created what movie.
636+ * The intent for this is be used for developer testing when the ffmpeg libs
637+ * change or the code inside our ffmpeg module changes. For each event, the
638+ * container type will change. This way, you can turn on emulate motion, then
639+ * specify a maximum movie time and let Motion run for days creating all the
640+ * different types of movies checking for crashes, warnings, etc.
634641 */
635- snprintf ( codec , sizeof ( codec ), "%s" , cnt -> conf .ffmpeg_video_codec ) ;
642+ codec = cnt -> conf .ffmpeg_video_codec ;
636643 if (strcmp (codec , "test" ) == 0 ) {
637644 MOTION_LOG (NTC , TYPE_ENCODER , NO_ERRNO , "%s Running test of the various output formats." );
638- codenbr = cnt -> event_nr ;
639- while (codenbr > 10 ){
640- codenbr -= 10 ;
641- }
645+ codenbr = cnt -> event_nr % 10 ;
642646 switch (codenbr ) {
643647 case 1 :
644- snprintf ( codec , sizeof ( codec ), "%s" , " mpeg4") ;
648+ codec = " mpeg4" ;
645649 break ;
646650 case 2 :
647- snprintf ( codec , sizeof ( codec ), "%s" , " msmpeg4") ;
651+ codec = " msmpeg4" ;
648652 break ;
649653 case 3 :
650- snprintf ( codec , sizeof ( codec ), "%s" , " swf") ;
654+ codec = " swf" ;
651655 break ;
652656 case 4 :
653- snprintf ( codec , sizeof ( codec ), "%s" , " flv") ;
657+ codec = " flv" ;
654658 break ;
655659 case 5 :
656- snprintf ( codec , sizeof ( codec ), "%s" , " ffv1") ;
660+ codec = " ffv1" ;
657661 break ;
658662 case 6 :
659- snprintf ( codec , sizeof ( codec ), "%s" , " mov") ;
663+ codec = " mov" ;
660664 break ;
661665 case 7 :
662- snprintf ( codec , sizeof ( codec ), "%s" , " mp4") ;
666+ codec = " mp4" ;
663667 break ;
664668 case 8 :
665- snprintf ( codec , sizeof ( codec ), "%s" , " mkv") ;
669+ codec = " mkv" ;
666670 break ;
667671 case 9 :
668- snprintf ( codec , sizeof ( codec ), "%s" , " hevc") ;
672+ codec = " hevc" ;
669673 break ;
670674 default :
671- snprintf ( codec , sizeof ( codec ), "%s" , " msmpeg4") ;
675+ codec = " msmpeg4" ;
672676 break ;
673677 }
674678 snprintf (cnt -> motionfilename , PATH_MAX - 4 , "%s/%s_%sm" , cnt -> conf .filepath , codec , stamp );
0 commit comments