History

Merge "Avoid encoding garbage when ivfenc encounters an unsupported Y4M file."

John Koleszar committed 16 years ago

Commit d024d982 parents 1114183 e703af91 file · +20 −13Browse files

Unified · Split

ivfenc.c+20−13
@@ -299,12 +299,11 @@ static int read_frame(FILE *f, vpx_image_t *img, unsigned int file_type, · 298 unmodified lines
299}299}
300 300
301 301
302unsigned int file_is_y4m(FILE *infile,302unsigned int file_is_y4m(FILE *infile,
303 y4m_input *y4m,303 y4m_input *y4m,
304 char detect[4])304 char detect[4])
305{305{
306 if(memcmp(detect, "YUV4", 4) == 0 &&306 if(memcmp(detect, "YUV4", 4) == 0)
307 y4m_input_open(y4m, infile, detect, 4) >= 0)
308 {307 {
309 return 1;308 return 1;
310 }309 }
@@ -875,18 +874,26 @@ int main(int argc, const char **argv_) · 564 unmodified lines
875 874
876 if (file_is_y4m(infile, &y4m, detect.buf))875 if (file_is_y4m(infile, &y4m, detect.buf))
877 {876 {
878 file_type = FILE_TYPE_Y4M;877 if (y4m_input_open(&y4m, infile, detect.buf, 4) >= 0)
879 cfg.g_w = y4m.pic_w;
880 cfg.g_h = y4m.pic_h;
881 /* Use the frame rate from the file only if none was specified on the
882 * command-line.
883 */
884 if (!arg_have_timebase)
885 {878 {
886 cfg.g_timebase.num = y4m.fps_d;879 file_type = FILE_TYPE_Y4M;
887 cfg.g_timebase.den = y4m.fps_n;880 cfg.g_w = y4m.pic_w;
881 cfg.g_h = y4m.pic_h;
882 /* Use the frame rate from the file only if none was specified
883 * on the command-line.
884 */
885 if (!arg_have_timebase)
886 {
887 cfg.g_timebase.num = y4m.fps_d;
888 cfg.g_timebase.den = y4m.fps_n;
889 }
890 arg_use_i420 = 0;
891 }
892 else
893 {
894 fprintf(stderr, "Unsupported Y4M stream.\n");
895 return EXIT_FAILURE;
888 }896 }
889 arg_use_i420 = 0;
890 }897 }
891 else if (file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))898 else if (file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
892 {899 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t