comparison utils.c @ 583:7793767ffe35 libavformat

move p*m from image/lavf -> image2/lavc video/audio_codec_id in AVFormatParameters to override/help demuxer av_guess_codec() to guess the default codecs based upon muxer + filename
author michael
date Thu, 11 Nov 2004 18:09:28 +0000
parents 03377d4de76a
children d31051b85c3d
comparison
equal deleted inserted replaced
582:c5ff083848b4 583:7793767ffe35
77 int score_max, score; 77 int score_max, score;
78 78
79 /* specific test for image sequences */ 79 /* specific test for image sequences */
80 if (!short_name && filename && 80 if (!short_name && filename &&
81 filename_number_test(filename) >= 0 && 81 filename_number_test(filename) >= 0 &&
82 av_guess_image2_codec(filename) != CODEC_ID_NONE) {
83 return guess_format("image2", NULL, NULL);
84 }
85 if (!short_name && filename &&
86 filename_number_test(filename) >= 0 &&
82 guess_image_format(filename)) { 87 guess_image_format(filename)) {
83 return guess_format("image", NULL, NULL); 88 return guess_format("image", NULL, NULL);
84 } 89 }
85 90
86 /* find the proper file type */ 91 /* find the proper file type */
121 if (stream_fmt) 126 if (stream_fmt)
122 fmt = stream_fmt; 127 fmt = stream_fmt;
123 } 128 }
124 129
125 return fmt; 130 return fmt;
131 }
132
133 /**
134 * guesses the codec id based upon muxer and filename.
135 */
136 enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
137 const char *filename, const char *mime_type, enum CodecType type){
138 if(type == CODEC_TYPE_VIDEO){
139 enum CodecID codec_id= CODEC_ID_NONE;
140
141 if(!strcmp(fmt->name, "image2")){
142 codec_id= av_guess_image2_codec(filename);
143 }
144 if(codec_id == CODEC_ID_NONE)
145 codec_id= fmt->video_codec;
146 return codec_id;
147 }else if(type == CODEC_TYPE_AUDIO)
148 return fmt->audio_codec;
149 else
150 return CODEC_ID_NONE;
126 } 151 }
127 152
128 AVInputFormat *av_find_input_format(const char *short_name) 153 AVInputFormat *av_find_input_format(const char *short_name)
129 { 154 {
130 AVInputFormat *fmt; 155 AVInputFormat *fmt;
1738 st->codec.codec_id == CODEC_ID_H264 || 1763 st->codec.codec_id == CODEC_ID_H264 ||
1739 st->codec.codec_id == CODEC_ID_H263 || 1764 st->codec.codec_id == CODEC_ID_H263 ||
1740 st->codec.codec_id == CODEC_ID_VORBIS || 1765 st->codec.codec_id == CODEC_ID_VORBIS ||
1741 st->codec.codec_id == CODEC_ID_MJPEG || 1766 st->codec.codec_id == CODEC_ID_MJPEG ||
1742 st->codec.codec_id == CODEC_ID_PNG || 1767 st->codec.codec_id == CODEC_ID_PNG ||
1768 st->codec.codec_id == CODEC_ID_PAM ||
1769 st->codec.codec_id == CODEC_ID_PGM ||
1770 st->codec.codec_id == CODEC_ID_PGMYUV ||
1771 st->codec.codec_id == CODEC_ID_PBM ||
1772 st->codec.codec_id == CODEC_ID_PPM ||
1743 (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))) 1773 (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing)))
1744 try_decode_frame(st, pkt->data, pkt->size); 1774 try_decode_frame(st, pkt->data, pkt->size);
1745 1775
1746 if (st->codec_info_duration >= MAX_STREAM_DURATION) { 1776 if (st->codec_info_duration >= MAX_STREAM_DURATION) {
1747 break; 1777 break;