Mercurial > libavformat.hg
comparison img2.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 | 10ad229f9d00 |
comparison
equal
deleted
inserted
replaced
582:c5ff083848b4 | 583:7793767ffe35 |
---|---|
36 static const IdStrMap img_tags[] = { | 36 static const IdStrMap img_tags[] = { |
37 { CODEC_ID_MJPEG , "jpeg"}, | 37 { CODEC_ID_MJPEG , "jpeg"}, |
38 { CODEC_ID_MJPEG , "jpg"}, | 38 { CODEC_ID_MJPEG , "jpg"}, |
39 { CODEC_ID_LJPEG , "ljpg"}, | 39 { CODEC_ID_LJPEG , "ljpg"}, |
40 { CODEC_ID_PNG , "png"}, | 40 { CODEC_ID_PNG , "png"}, |
41 { CODEC_ID_PPM , "ppm"}, | |
42 { CODEC_ID_PGM , "pgm"}, | |
43 { CODEC_ID_PGMYUV , "pgmyuv"}, | |
44 { CODEC_ID_PBM , "pbm"}, | |
45 { CODEC_ID_PAM , "pam"}, | |
41 { CODEC_ID_MPEG1VIDEO, "mpg1-img"}, | 46 { CODEC_ID_MPEG1VIDEO, "mpg1-img"}, |
42 { CODEC_ID_MPEG2VIDEO, "mpg2-img"}, | 47 { CODEC_ID_MPEG2VIDEO, "mpg2-img"}, |
43 { CODEC_ID_MPEG4 , "mpg4-img"}, | 48 { CODEC_ID_MPEG4 , "mpg4-img"}, |
44 { CODEC_ID_FFV1 , "ffv1-img"}, | 49 { CODEC_ID_FFV1 , "ffv1-img"}, |
45 {0, NULL} | 50 {0, NULL} |
131 return AVPROBE_SCORE_MAX; | 136 return AVPROBE_SCORE_MAX; |
132 else | 137 else |
133 return 0; | 138 return 0; |
134 } | 139 } |
135 | 140 |
141 enum CodecID av_guess_image2_codec(const char *filename){ | |
142 return av_str2id(img_tags, filename); | |
143 } | |
144 | |
136 static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) | 145 static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
137 { | 146 { |
138 VideoData *s = s1->priv_data; | 147 VideoData *s = s1->priv_data; |
139 int first_index, last_index; | 148 int first_index, last_index; |
140 AVStream *st; | 149 AVStream *st; |
178 st->duration = ((int64_t)AV_TIME_BASE * | 187 st->duration = ((int64_t)AV_TIME_BASE * |
179 (last_index - first_index + 1) * | 188 (last_index - first_index + 1) * |
180 st->codec.frame_rate_base) / st->codec.frame_rate; | 189 st->codec.frame_rate_base) / st->codec.frame_rate; |
181 } | 190 } |
182 | 191 |
183 st->codec.codec_type = CODEC_TYPE_VIDEO; | 192 if(ap->video_codec_id){ |
184 st->codec.codec_id = av_str2id(img_tags, s->path); | 193 st->codec.codec_type = CODEC_TYPE_VIDEO; |
194 st->codec.codec_id = ap->video_codec_id; | |
195 }else if(ap->audio_codec_id){ | |
196 st->codec.codec_type = CODEC_TYPE_AUDIO; | |
197 st->codec.codec_id = ap->audio_codec_id; | |
198 }else{ | |
199 st->codec.codec_type = CODEC_TYPE_VIDEO; | |
200 st->codec.codec_id = av_str2id(img_tags, s->path); | |
201 } | |
185 | 202 |
186 return 0; | 203 return 0; |
187 | 204 |
188 fail: | 205 fail: |
189 av_free(s); | 206 av_free(s); |