OSDN Git Service

lavf: deprecate AVStream.quality.
authorAnton Khirnov <anton@khirnov.net>
Mon, 20 Jun 2011 11:08:40 +0000 (13:08 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 6 Jul 2011 18:10:41 +0000 (20:10 +0200)
AVStream is no place for it and it's unused outside of ffmpeg anyway.

ffmpeg.c
libavformat/avformat.h
libavformat/ffmdec.c
libavformat/ffmenc.c
libavformat/version.h
tests/ref/lavf/ffm

index 1a4d2a1..29d9d17 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -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;
index 12490c1..9011099 100644 (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.
index 91ab2e4..ed93270 100644 (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);
index 9a3eb40..a31ac8e 100644 (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);
index 3cc1718..0cf383f 100644 (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 */
index b89af6e..b20e132 100644 (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