OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 *bytes_read = frame_size; | 212 *bytes_read = frame_size; |
213 } | 213 } |
214 | 214 |
215 return 0; | 215 return 0; |
216 } | 216 } |
217 | 217 |
218 static int read_frame(struct VpxDecInputContext *input, uint8_t **buf, | 218 static int read_frame(struct VpxDecInputContext *input, uint8_t **buf, |
219 size_t *bytes_in_buffer, size_t *buffer_size) { | 219 size_t *bytes_in_buffer, size_t *buffer_size) { |
220 switch (input->vpx_input_ctx->file_type) { | 220 switch (input->vpx_input_ctx->file_type) { |
| 221 #if CONFIG_WEBM_IO |
221 case FILE_TYPE_WEBM: | 222 case FILE_TYPE_WEBM: |
222 return webm_read_frame(input->webm_ctx, | 223 return webm_read_frame(input->webm_ctx, |
223 buf, bytes_in_buffer, buffer_size); | 224 buf, bytes_in_buffer, buffer_size); |
| 225 #endif |
224 case FILE_TYPE_RAW: | 226 case FILE_TYPE_RAW: |
225 return raw_read_frame(input->vpx_input_ctx->file, | 227 return raw_read_frame(input->vpx_input_ctx->file, |
226 buf, bytes_in_buffer, buffer_size); | 228 buf, bytes_in_buffer, buffer_size); |
227 case FILE_TYPE_IVF: | 229 case FILE_TYPE_IVF: |
228 return ivf_read_frame(input->vpx_input_ctx->file, | 230 return ivf_read_frame(input->vpx_input_ctx->file, |
229 buf, bytes_in_buffer, buffer_size); | 231 buf, bytes_in_buffer, buffer_size); |
230 default: | 232 default: |
231 return 1; | 233 return 1; |
232 } | 234 } |
233 } | 235 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) { | 658 if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) { |
657 fprintf(stderr, | 659 fprintf(stderr, |
658 "Not dumping raw video to your terminal. Use '-o -' to " | 660 "Not dumping raw video to your terminal. Use '-o -' to " |
659 "override.\n"); | 661 "override.\n"); |
660 return EXIT_FAILURE; | 662 return EXIT_FAILURE; |
661 } | 663 } |
662 #endif | 664 #endif |
663 input.vpx_input_ctx->file = infile; | 665 input.vpx_input_ctx->file = infile; |
664 if (file_is_ivf(input.vpx_input_ctx)) | 666 if (file_is_ivf(input.vpx_input_ctx)) |
665 input.vpx_input_ctx->file_type = FILE_TYPE_IVF; | 667 input.vpx_input_ctx->file_type = FILE_TYPE_IVF; |
| 668 #if CONFIG_WEBM_IO |
666 else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx)) | 669 else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx)) |
667 input.vpx_input_ctx->file_type = FILE_TYPE_WEBM; | 670 input.vpx_input_ctx->file_type = FILE_TYPE_WEBM; |
| 671 #endif |
668 else if (file_is_raw(input.vpx_input_ctx)) | 672 else if (file_is_raw(input.vpx_input_ctx)) |
669 input.vpx_input_ctx->file_type = FILE_TYPE_RAW; | 673 input.vpx_input_ctx->file_type = FILE_TYPE_RAW; |
670 else { | 674 else { |
671 fprintf(stderr, "Unrecognized input file type.\n"); | 675 fprintf(stderr, "Unrecognized input file type.\n"); |
| 676 #if !CONFIG_WEBM_IO |
| 677 fprintf(stderr, "vpxdec was built without WebM container support.\n"); |
| 678 #endif |
672 return EXIT_FAILURE; | 679 return EXIT_FAILURE; |
673 } | 680 } |
674 | 681 |
675 outfile_pattern = outfile_pattern ? outfile_pattern : "-"; | 682 outfile_pattern = outfile_pattern ? outfile_pattern : "-"; |
676 single_file = is_single_file(outfile_pattern); | 683 single_file = is_single_file(outfile_pattern); |
677 | 684 |
678 if (!noblit && single_file) { | 685 if (!noblit && single_file) { |
679 generate_filename(outfile_pattern, outfile_name, PATH_MAX, | 686 generate_filename(outfile_pattern, outfile_name, PATH_MAX, |
680 vpx_input_ctx.width, vpx_input_ctx.height, 0); | 687 vpx_input_ctx.width, vpx_input_ctx.height, 0); |
681 if (do_md5) | 688 if (do_md5) |
682 MD5Init(&md5_ctx); | 689 MD5Init(&md5_ctx); |
683 else | 690 else |
684 outfile = open_outfile(outfile_name); | 691 outfile = open_outfile(outfile_name); |
685 } | 692 } |
686 | 693 |
687 if (use_y4m && !noblit) { | 694 if (use_y4m && !noblit) { |
688 if (!single_file) { | 695 if (!single_file) { |
689 fprintf(stderr, "YUV4MPEG2 not supported with output patterns," | 696 fprintf(stderr, "YUV4MPEG2 not supported with output patterns," |
690 " try --i420 or --yv12.\n"); | 697 " try --i420 or --yv12.\n"); |
691 return EXIT_FAILURE; | 698 return EXIT_FAILURE; |
692 } | 699 } |
693 | 700 |
| 701 #if CONFIG_WEBM_IO |
694 if (vpx_input_ctx.file_type == FILE_TYPE_WEBM) { | 702 if (vpx_input_ctx.file_type == FILE_TYPE_WEBM) { |
695 if (webm_guess_framerate(input.webm_ctx, input.vpx_input_ctx)) { | 703 if (webm_guess_framerate(input.webm_ctx, input.vpx_input_ctx)) { |
696 fprintf(stderr, "Failed to guess framerate -- error parsing " | 704 fprintf(stderr, "Failed to guess framerate -- error parsing " |
697 "webm file?\n"); | 705 "webm file?\n"); |
698 return EXIT_FAILURE; | 706 return EXIT_FAILURE; |
699 } | 707 } |
700 } | 708 } |
| 709 #endif |
701 } | 710 } |
702 | 711 |
703 fourcc_interface = get_vpx_decoder_by_fourcc(vpx_input_ctx.fourcc); | 712 fourcc_interface = get_vpx_decoder_by_fourcc(vpx_input_ctx.fourcc); |
704 if (interface && fourcc_interface && interface != fourcc_interface) | 713 if (interface && fourcc_interface && interface != fourcc_interface) |
705 warn("Header indicates codec: %s\n", fourcc_interface->name); | 714 warn("Header indicates codec: %s\n", fourcc_interface->name); |
706 else | 715 else |
707 interface = fourcc_interface; | 716 interface = fourcc_interface; |
708 | 717 |
709 if (!interface) | 718 if (!interface) |
710 interface = get_vpx_decoder_by_index(0); | 719 interface = get_vpx_decoder_by_index(0); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 943 |
935 if (!noblit && single_file) { | 944 if (!noblit && single_file) { |
936 if (do_md5) { | 945 if (do_md5) { |
937 MD5Final(md5_digest, &md5_ctx); | 946 MD5Final(md5_digest, &md5_ctx); |
938 print_md5(md5_digest, outfile_name); | 947 print_md5(md5_digest, outfile_name); |
939 } else { | 948 } else { |
940 fclose(outfile); | 949 fclose(outfile); |
941 } | 950 } |
942 } | 951 } |
943 | 952 |
| 953 #if CONFIG_WEBM_IO |
944 if (input.vpx_input_ctx->file_type == FILE_TYPE_WEBM) | 954 if (input.vpx_input_ctx->file_type == FILE_TYPE_WEBM) |
945 webm_free(input.webm_ctx); | 955 webm_free(input.webm_ctx); |
946 else | 956 #endif |
| 957 |
| 958 if (input.vpx_input_ctx->file_type != FILE_TYPE_WEBM) |
947 free(buf); | 959 free(buf); |
948 | 960 |
949 if (scaled_img) vpx_img_free(scaled_img); | 961 if (scaled_img) vpx_img_free(scaled_img); |
950 | 962 |
951 for (i = 0; i < ext_fb_list.num_external_frame_buffers; ++i) { | 963 for (i = 0; i < ext_fb_list.num_external_frame_buffers; ++i) { |
952 free(ext_fb_list.ext_fb[i].data); | 964 free(ext_fb_list.ext_fb[i].data); |
953 } | 965 } |
954 free(ext_fb_list.ext_fb); | 966 free(ext_fb_list.ext_fb); |
955 | 967 |
956 fclose(infile); | 968 fclose(infile); |
(...skipping 16 matching lines...) Expand all Loading... |
973 if (arg_match(&arg, &looparg, argi)) { | 985 if (arg_match(&arg, &looparg, argi)) { |
974 loops = arg_parse_uint(&arg); | 986 loops = arg_parse_uint(&arg); |
975 break; | 987 break; |
976 } | 988 } |
977 } | 989 } |
978 free(argv); | 990 free(argv); |
979 for (i = 0; !error && i < loops; i++) | 991 for (i = 0; !error && i < loops; i++) |
980 error = main_loop(argc, argv_); | 992 error = main_loop(argc, argv_); |
981 return error; | 993 return error; |
982 } | 994 } |
OLD | NEW |