mirror of
https://github.com/Motion-Project/motion.git
synced 2026-05-19 12:05:54 -04:00
Better implementation of the test codec
This commit is contained in:
40
event.c
40
event.c
@@ -608,7 +608,7 @@ static void event_ffmpeg_newfile(struct context *cnt,
|
||||
unsigned char *convbuf, *y, *u, *v;
|
||||
char stamp[PATH_MAX];
|
||||
const char *moviepath;
|
||||
char codec[8];
|
||||
const char *codec;
|
||||
long codenbr;
|
||||
|
||||
if (!cnt->conf.ffmpeg_output && !cnt->conf.ffmpeg_output_debug)
|
||||
@@ -629,46 +629,50 @@ static void event_ffmpeg_newfile(struct context *cnt,
|
||||
* motion movies get the same name as normal movies plus an appended 'm'
|
||||
* PATH_MAX - 4 to allow for .mpg to be appended without overflow
|
||||
*/
|
||||
/* Set up a testing / evaluation codec which will use a different
|
||||
* codec for the events.
|
||||
|
||||
/* The following section allows for testing of all the various containers
|
||||
* that Motion permits. The container type is pre-pended to the name of the
|
||||
* file so that we can determine which container type created what movie.
|
||||
* The intent for this is be used for developer testing when the ffmpeg libs
|
||||
* change or the code inside our ffmpeg module changes. For each event, the
|
||||
* container type will change. This way, you can turn on emulate motion, then
|
||||
* specify a maximum movie time and let Motion run for days creating all the
|
||||
* different types of movies checking for crashes, warnings, etc.
|
||||
*/
|
||||
snprintf(codec, sizeof(codec), "%s", cnt->conf.ffmpeg_video_codec);
|
||||
codec = cnt->conf.ffmpeg_video_codec;
|
||||
if (strcmp(codec, "test") == 0) {
|
||||
MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO, "%s Running test of the various output formats.");
|
||||
codenbr = cnt->event_nr;
|
||||
while (codenbr > 10){
|
||||
codenbr -= 10;
|
||||
}
|
||||
codenbr = cnt->event_nr % 10;
|
||||
switch (codenbr) {
|
||||
case 1:
|
||||
snprintf(codec, sizeof(codec), "%s", "mpeg4");
|
||||
codec = "mpeg4";
|
||||
break;
|
||||
case 2:
|
||||
snprintf(codec, sizeof(codec), "%s", "msmpeg4");
|
||||
codec = "msmpeg4";
|
||||
break;
|
||||
case 3:
|
||||
snprintf(codec, sizeof(codec), "%s", "swf");
|
||||
codec = "swf";
|
||||
break;
|
||||
case 4:
|
||||
snprintf(codec, sizeof(codec), "%s", "flv");
|
||||
codec = "flv";
|
||||
break;
|
||||
case 5:
|
||||
snprintf(codec, sizeof(codec), "%s", "ffv1");
|
||||
codec = "ffv1";
|
||||
break;
|
||||
case 6:
|
||||
snprintf(codec, sizeof(codec), "%s", "mov");
|
||||
codec = "mov";
|
||||
break;
|
||||
case 7:
|
||||
snprintf(codec, sizeof(codec), "%s", "mp4");
|
||||
codec = "mp4";
|
||||
break;
|
||||
case 8:
|
||||
snprintf(codec, sizeof(codec), "%s", "mkv");
|
||||
codec = "mkv";
|
||||
break;
|
||||
case 9:
|
||||
snprintf(codec, sizeof(codec), "%s", "hevc");
|
||||
codec = "hevc";
|
||||
break;
|
||||
default:
|
||||
snprintf(codec, sizeof(codec), "%s", "msmpeg4");
|
||||
codec = "msmpeg4";
|
||||
break;
|
||||
}
|
||||
snprintf(cnt->motionfilename, PATH_MAX - 4, "%s/%s_%sm", cnt->conf.filepath, codec, stamp);
|
||||
|
||||
Reference in New Issue
Block a user