Commit 5e8d2e33 authored by Anton Khirnov's avatar Anton Khirnov

lavf: deprecate AVStream.quality.

AVStream is no place for it and it's unused outside of ffmpeg anyway.
parent df64da3b
...@@ -1123,7 +1123,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1123,7 +1123,7 @@ static void do_video_out(AVFormatContext *s,
AVOutputStream *ost, AVOutputStream *ost,
AVInputStream *ist, AVInputStream *ist,
AVFrame *in_picture, AVFrame *in_picture,
int *frame_size) int *frame_size, float quality)
{ {
int nb_frames, i, ret, resample_changed; int nb_frames, i, ret, resample_changed;
AVFrame *final_picture, *formatted_picture; AVFrame *final_picture, *formatted_picture;
...@@ -1245,7 +1245,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1245,7 +1245,7 @@ static void do_video_out(AVFormatContext *s,
/* handles sameq here. This is not correct because it may /* handles sameq here. This is not correct because it may
not be a global option */ not be a global option */
big_picture.quality = same_quality ? ist->st->quality : ost->st->quality; big_picture.quality = quality;
if(!me_threshold) if(!me_threshold)
big_picture.pict_type = 0; big_picture.pict_type = 0;
// big_picture.pts = AV_NOPTS_VALUE; // big_picture.pts = AV_NOPTS_VALUE;
...@@ -1480,6 +1480,7 @@ static int output_packet(AVInputStream *ist, int ist_index, ...@@ -1480,6 +1480,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
int frame_available; int frame_available;
#endif #endif
float quality;
AVPacket avpkt; AVPacket avpkt;
int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); 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, ...@@ -1560,7 +1561,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = avcodec_decode_video2(ist->st->codec, ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_output, &avpkt); &picture, &got_output, &avpkt);
ist->st->quality= picture.quality; quality = same_quality ? picture.quality : 0;
if (ret < 0) if (ret < 0)
goto fail_decode; goto fail_decode;
if (!got_output) { if (!got_output) {
...@@ -1685,7 +1686,8 @@ static int output_packet(AVInputStream *ist, int ist_index, ...@@ -1685,7 +1686,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
if (ost->picref->video && !ost->frame_aspect_ratio) if (ost->picref->video && !ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect; ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
#endif #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) if (vstats_filename && frame_size)
do_video_stats(os, ost, frame_size); do_video_stats(os, ost, frame_size);
break; break;
...@@ -3495,8 +3497,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) ...@@ -3495,8 +3497,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
video_enc->gop_size = 0; video_enc->gop_size = 0;
if (video_qscale || same_quality) { if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality= video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
st->quality = FF_QP2LAMBDA * video_qscale;
} }
if(intra_matrix) if(intra_matrix)
...@@ -3614,7 +3615,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) ...@@ -3614,7 +3615,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
if (audio_qscale > QSCALE_NONE) { if (audio_qscale > QSCALE_NONE) {
audio_enc->flags |= CODEC_FLAG_QSCALE; 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) if (audio_channels)
audio_enc->channels = audio_channels; audio_enc->channels = audio_channels;
......
...@@ -523,12 +523,14 @@ typedef struct AVStream { ...@@ -523,12 +523,14 @@ typedef struct AVStream {
int stream_copy; /**< If set, just copy stream. */ 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. 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? //FIXME move stuff to a flags field?
/** /**
* Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. * Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
* MN: dunno if that is the right place for it * 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. * Decoding: pts of the first frame of the stream, in stream time base.
......
...@@ -301,7 +301,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -301,7 +301,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->codec_id = avio_rb32(pb); codec->codec_id = avio_rb32(pb);
codec->codec_type = avio_r8(pb); /* codec_type */ codec->codec_type = avio_r8(pb); /* codec_type */
codec->bit_rate = avio_rb32(pb); codec->bit_rate = avio_rb32(pb);
st->quality = avio_rb32(pb);
codec->flags = avio_rb32(pb); codec->flags = avio_rb32(pb);
codec->flags2 = avio_rb32(pb); codec->flags2 = avio_rb32(pb);
codec->debug = avio_rb32(pb); codec->debug = avio_rb32(pb);
......
...@@ -114,7 +114,6 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -114,7 +114,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->codec_id); avio_wb32(pb, codec->codec_id);
avio_w8(pb, codec->codec_type); avio_w8(pb, codec->codec_type);
avio_wb32(pb, codec->bit_rate); avio_wb32(pb, codec->bit_rate);
avio_wb32(pb, st->quality);
avio_wb32(pb, codec->flags); avio_wb32(pb, codec->flags);
avio_wb32(pb, codec->flags2); avio_wb32(pb, codec->flags2);
avio_wb32(pb, codec->debug); avio_wb32(pb, codec->debug);
......
...@@ -74,5 +74,8 @@ ...@@ -74,5 +74,8 @@
#ifndef FF_API_FLAG_RTP_HINT #ifndef FF_API_FLAG_RTP_HINT
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54) #define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif #endif
#ifndef FF_API_AVSTREAM_QUALITY
#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#endif /* AVFORMAT_VERSION_H */ #endif /* AVFORMAT_VERSION_H */
b6acf782a38d313153b68c4ca204fc90 *./tests/data/lavf/lavf.ffm f9bee27ea1b6b83a06b5f9efb0a4ac1f *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm 376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0xf361ed74 ./tests/data/lavf/lavf.ffm CRC=0xf361ed74
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment