diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-04-25 18:29:06 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-04-25 18:29:06 +0000 |
commit | 644a92626a94d6f24110309cb2dc7d9ec3e79f25 (patch) | |
tree | 536101865dc2b937f4e4587909c299dc6f434b84 /libavformat | |
parent | 3ca4b65479f587d5d79080699d16cdd5c9ec7e0a (diff) | |
download | ffmpeg-644a92626a94d6f24110309cb2dc7d9ec3e79f25.tar.gz |
PIX_FMT_NONE and related fixes
Originally committed as revision 4161 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/img2.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c index 0a53a5b824..0d58604beb 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -222,7 +222,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) st->codec.codec_type = CODEC_TYPE_VIDEO; st->codec.codec_id = av_str2id(img_tags, s->path); } - if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt) + if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE) st->codec.pix_fmt = ap->pix_fmt; return 0; diff --git a/libavformat/utils.c b/libavformat/utils.c index 97b060daa6..cb43df4ece 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1682,7 +1682,7 @@ static int has_codec_parameters(AVCodecContext *enc) val = enc->sample_rate; break; case CODEC_TYPE_VIDEO: - val = enc->width; + val = enc->width && enc->pix_fmt != PIX_FMT_NONE; break; default: val = 1; @@ -1704,6 +1704,8 @@ static int try_decode_frame(AVStream *st, const uint8_t *data, int size) ret = avcodec_open(&st->codec, codec); if (ret < 0) return ret; + + if(!has_codec_parameters(&st->codec)){ switch(st->codec.codec_type) { case CODEC_TYPE_VIDEO: ret = avcodec_decode_video(&st->codec, &picture, @@ -1720,6 +1722,7 @@ static int try_decode_frame(AVStream *st, const uint8_t *data, int size) default: break; } + } fail: avcodec_close(&st->codec); return ret; @@ -1739,6 +1742,7 @@ static int try_decode_frame(AVStream *st, const uint8_t *data, int size) * * @param ic media file handle * @return >=0 if OK. AVERROR_xxx if error. + * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need */ int av_find_stream_info(AVFormatContext *ic) { @@ -1841,7 +1845,7 @@ int av_find_stream_info(AVFormatContext *ic) decompress the frame. We try to avoid that in most cases as it takes longer and uses more memory. For MPEG4, we need to decompress for Quicktime. */ - if (!has_codec_parameters(&st->codec) && + if (!has_codec_parameters(&st->codec) /*&& (st->codec.codec_id == CODEC_ID_FLV1 || st->codec.codec_id == CODEC_ID_H264 || st->codec.codec_id == CODEC_ID_H263 || @@ -1855,7 +1859,7 @@ int av_find_stream_info(AVFormatContext *ic) st->codec.codec_id == CODEC_ID_PBM || st->codec.codec_id == CODEC_ID_PPM || st->codec.codec_id == CODEC_ID_SHORTEN || - (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))) + (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/) try_decode_frame(st, pkt->data, pkt->size); if (st->codec_info_duration >= MAX_STREAM_DURATION) { |