comparison utils.c @ 1169:d18cc9a1fd02 libavformat

allow individual selection of muxers and demuxers
author mru
date Mon, 10 Jul 2006 21:14:37 +0000
parents d89d7ef290da
children 13dc486b272b
comparison
equal deleted inserted replaced
1168:c894489e2abe 1169:d18cc9a1fd02
88 { 88 {
89 AVOutputFormat *fmt, *fmt_found; 89 AVOutputFormat *fmt, *fmt_found;
90 int score_max, score; 90 int score_max, score;
91 91
92 /* specific test for image sequences */ 92 /* specific test for image sequences */
93 #ifdef CONFIG_IMAGE2_MUXER
93 if (!short_name && filename && 94 if (!short_name && filename &&
94 filename_number_test(filename) >= 0 && 95 filename_number_test(filename) >= 0 &&
95 av_guess_image2_codec(filename) != CODEC_ID_NONE) { 96 av_guess_image2_codec(filename) != CODEC_ID_NONE) {
96 return guess_format("image2", NULL, NULL); 97 return guess_format("image2", NULL, NULL);
97 } 98 }
99 #endif
98 if (!short_name && filename && 100 if (!short_name && filename &&
99 filename_number_test(filename) >= 0 && 101 filename_number_test(filename) >= 0 &&
100 guess_image_format(filename)) { 102 guess_image_format(filename)) {
101 return guess_format("image", NULL, NULL); 103 return guess_format("image", NULL, NULL);
102 } 104 }
149 enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, 151 enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
150 const char *filename, const char *mime_type, enum CodecType type){ 152 const char *filename, const char *mime_type, enum CodecType type){
151 if(type == CODEC_TYPE_VIDEO){ 153 if(type == CODEC_TYPE_VIDEO){
152 enum CodecID codec_id= CODEC_ID_NONE; 154 enum CodecID codec_id= CODEC_ID_NONE;
153 155
156 #ifdef CONFIG_IMAGE2_MUXER
154 if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){ 157 if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
155 codec_id= av_guess_image2_codec(filename); 158 codec_id= av_guess_image2_codec(filename);
156 } 159 }
160 #endif
157 if(codec_id == CODEC_ID_NONE) 161 if(codec_id == CODEC_ID_NONE)
158 codec_id= fmt->video_codec; 162 codec_id= fmt->video_codec;
159 return codec_id; 163 return codec_id;
160 }else if(type == CODEC_TYPE_AUDIO) 164 }else if(type == CODEC_TYPE_AUDIO)
161 return fmt->audio_codec; 165 return fmt->audio_codec;
1728 if (file_size < 0) 1732 if (file_size < 0)
1729 file_size = 0; 1733 file_size = 0;
1730 } 1734 }
1731 ic->file_size = file_size; 1735 ic->file_size = file_size;
1732 1736
1733 if ((ic->iformat == &mpegps_demuxer || ic->iformat == &mpegts_demuxer) && file_size && !ic->pb.is_streamed) { 1737 if ((!strcmp(ic->iformat->name, "mpeg") ||
1738 !strcmp(ic->iformat->name, "mpegts")) &&
1739 file_size && !ic->pb.is_streamed) {
1734 /* get accurate estimate from the PTSes */ 1740 /* get accurate estimate from the PTSes */
1735 av_estimate_timings_from_pts(ic); 1741 av_estimate_timings_from_pts(ic);
1736 } else if (av_has_timings(ic)) { 1742 } else if (av_has_timings(ic)) {
1737 /* at least one components has timings - we use them for all 1743 /* at least one components has timings - we use them for all
1738 the components */ 1744 the components */