lavf: deprecate AVStream.quality.

AVStream is no place for it and it's unused outside of ffmpeg anyway.
This commit is contained in:
Anton Khirnov 2011-06-20 13:08:40 +02:00
parent df64da3b1e
commit 5e8d2e337e
6 changed files with 15 additions and 11 deletions

View File

@ -1123,7 +1123,7 @@ static void do_video_out(AVFormatContext *s,
AVOutputStream *ost,
AVInputStream *ist,
AVFrame *in_picture,
int *frame_size)
int *frame_size, float quality)
{
int nb_frames, i, ret, resample_changed;
AVFrame *final_picture, *formatted_picture;
@ -1245,7 +1245,7 @@ static void do_video_out(AVFormatContext *s,
/* handles sameq here. This is not correct because it may
not be a global option */
big_picture.quality = same_quality ? ist->st->quality : ost->st->quality;
big_picture.quality = quality;
if(!me_threshold)
big_picture.pict_type = 0;
// big_picture.pts = AV_NOPTS_VALUE;
@ -1480,6 +1480,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
#if CONFIG_AVFILTER
int frame_available;
#endif
float quality;
AVPacket avpkt;
int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
@ -1560,7 +1561,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_output, &avpkt);
ist->st->quality= picture.quality;
quality = same_quality ? picture.quality : 0;
if (ret < 0)
goto fail_decode;
if (!got_output) {
@ -1685,7 +1686,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
if (ost->picref->video && !ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
#endif
do_video_out(os, ost, ist, &picture, &frame_size);
do_video_out(os, ost, ist, &picture, &frame_size,
same_quality ? quality : ost->st->codec->global_quality);
if (vstats_filename && frame_size)
do_video_stats(os, ost, frame_size);
break;
@ -3495,8 +3497,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
@ -3614,7 +3615,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
if (audio_qscale > QSCALE_NONE) {
audio_enc->flags |= CODEC_FLAG_QSCALE;
audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
audio_enc->global_quality = FF_QP2LAMBDA * audio_qscale;
}
if (audio_channels)
audio_enc->channels = audio_channels;

View File

@ -523,12 +523,14 @@ typedef struct AVStream {
int stream_copy; /**< If set, just copy stream. */
enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
#if FF_API_AVSTREAM_QUALITY
//FIXME move stuff to a flags field?
/**
* Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
* MN: dunno if that is the right place for it
*/
float quality;
attribute_deprecated float quality;
#endif
/**
* Decoding: pts of the first frame of the stream, in stream time base.

View File

@ -301,7 +301,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->codec_id = avio_rb32(pb);
codec->codec_type = avio_r8(pb); /* codec_type */
codec->bit_rate = avio_rb32(pb);
st->quality = avio_rb32(pb);
codec->flags = avio_rb32(pb);
codec->flags2 = avio_rb32(pb);
codec->debug = avio_rb32(pb);

View File

@ -114,7 +114,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->codec_id);
avio_w8(pb, codec->codec_type);
avio_wb32(pb, codec->bit_rate);
avio_wb32(pb, st->quality);
avio_wb32(pb, codec->flags);
avio_wb32(pb, codec->flags2);
avio_wb32(pb, codec->debug);

View File

@ -74,5 +74,8 @@
#ifndef FF_API_FLAG_RTP_HINT
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVSTREAM_QUALITY
#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#endif /* AVFORMAT_VERSION_H */

View File

@ -1,3 +1,3 @@
b6acf782a38d313153b68c4ca204fc90 *./tests/data/lavf/lavf.ffm
f9bee27ea1b6b83a06b5f9efb0a4ac1f *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0xf361ed74