summaryrefslogtreecommitdiff
path: root/libavformat/img2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-11-11 18:09:28 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-11-11 18:09:28 +0000
commit5b6d5596807e546d87f0afd1fb760b0f887b5c97 (patch)
tree5dd9a2ecb25fed8a62a58e5e11eb840a0cea76aa /libavformat/img2.c
parent6c3890b6d34ee0ee00db710b79454e4ada6c586c (diff)
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 Originally committed as revision 3668 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/img2.c')
-rw-r--r--libavformat/img2.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c
index f05a43a8e8..f230891063 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -38,6 +38,11 @@ static const IdStrMap img_tags[] = {
{ CODEC_ID_MJPEG , "jpg"},
{ CODEC_ID_LJPEG , "ljpg"},
{ CODEC_ID_PNG , "png"},
+ { CODEC_ID_PPM , "ppm"},
+ { CODEC_ID_PGM , "pgm"},
+ { CODEC_ID_PGMYUV , "pgmyuv"},
+ { CODEC_ID_PBM , "pbm"},
+ { CODEC_ID_PAM , "pam"},
{ CODEC_ID_MPEG1VIDEO, "mpg1-img"},
{ CODEC_ID_MPEG2VIDEO, "mpg2-img"},
{ CODEC_ID_MPEG4 , "mpg4-img"},
@@ -133,6 +138,10 @@ static int image_probe(AVProbeData *p)
return 0;
}
+enum CodecID av_guess_image2_codec(const char *filename){
+ return av_str2id(img_tags, filename);
+}
+
static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
{
VideoData *s = s1->priv_data;
@@ -180,8 +189,16 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec.frame_rate_base) / st->codec.frame_rate;
}
- st->codec.codec_type = CODEC_TYPE_VIDEO;
- st->codec.codec_id = av_str2id(img_tags, s->path);
+ if(ap->video_codec_id){
+ st->codec.codec_type = CODEC_TYPE_VIDEO;
+ st->codec.codec_id = ap->video_codec_id;
+ }else if(ap->audio_codec_id){
+ st->codec.codec_type = CODEC_TYPE_AUDIO;
+ st->codec.codec_id = ap->audio_codec_id;
+ }else{
+ st->codec.codec_type = CODEC_TYPE_VIDEO;
+ st->codec.codec_id = av_str2id(img_tags, s->path);
+ }
return 0;