Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
avcodec_default_reget_buffer(): fix compilation in DEBUG mode
fate: Overhaul WavPack coverage
h264: fix mmxext chroma deblock to use correct TC values.
flvdec: Remove the now redundant check for known broken metadata creator
flvdec: Validate index entries added from metadata while reading
rtsp: Handle requests from server to client
movenc: use timestamps instead of frame_size for samples-per-packet
movenc: use the first cluster duration as the tfhd default duration
movenc: factorize calculation of cluster duration into a separate function
doc/APIchanges: fill in missing dates and hashes.
lavc: reorder AVCodecContext fields.
lavc: reorder AVFrame fields.

Conflicts:
doc/APIchanges
libavcodec/avcodec.h
libavformat/flvdec.c
libavformat/movenc.c
tests/fate/lossless-audio.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/02/28 11:38:58
Showing 9 changed files
... ...
@@ -35,19 +35,19 @@ API changes, most recent first:
35 35
 2012-01-24 - xxxxxxx - lavfi 2.60.100
36 36
   Add avfilter_graph_dump.
37 37
 
38
-2012-xx-xx - xxxxxxx - lavu 51.24.0 - error.h
38
+2012-02-25 - c9bca80 - lavu 51.24.0 - error.h
39 39
   Add AVERROR_UNKNOWN
40 40
 
41
-2012-xx-xx - xxxxxxx - lavc 54.x.x
41
+2012-02-20 - e9cda85 - lavc 54.2.0
42 42
   Add duration field to AVCodecParserContext
43 43
 
44
-2012-02-xx - xxxxxxx - lavu 51.23.1 - mathematics.h
44
+2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h
45 45
   Add av_rescale_q_rnd()
46 46
 
47
-2012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h
47
+2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h
48 48
   Add PIX_FMT_PSEUDOPAL flag.
49 49
 
50
-2012-02-01 - xxxxxxx - lavc 54.01.0
50
+2012-02-08 - 52f82a1 - lavc 54.01.0
51 51
   Add avcodec_encode_video2() and deprecate avcodec_encode_video().
52 52
 
53 53
 2012-02-01 - 316fc74 - lavc 54.01.0
... ...
@@ -891,12 +891,48 @@ typedef struct AVFrame {
891 891
     int linesize[AV_NUM_DATA_POINTERS];
892 892
 
893 893
     /**
894
-     * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
895
-     * This isn't used by libavcodec unless the default get/release_buffer() is used.
896
-     * - encoding:
897
-     * - decoding:
894
+     * pointers to the data planes/channels.
895
+     *
896
+     * For video, this should simply point to data[].
897
+     *
898
+     * For planar audio, each channel has a separate data pointer, and
899
+     * linesize[0] contains the size of each channel buffer.
900
+     * For packed audio, there is just one data pointer, and linesize[0]
901
+     * contains the total size of the buffer for all channels.
902
+     *
903
+     * Note: Both data and extended_data will always be set by get_buffer(),
904
+     * but for planar audio with more channels that can fit in data,
905
+     * extended_data must be used by the decoder in order to access all
906
+     * channels.
907
+     *
908
+     * encoding: unused
909
+     * decoding: set by AVCodecContext.get_buffer()
898 910
      */
899
-    uint8_t *base[AV_NUM_DATA_POINTERS];
911
+    uint8_t **extended_data;
912
+
913
+    /**
914
+     * width and height of the video frame
915
+     * - encoding: unused
916
+     * - decoding: Read by user.
917
+     */
918
+    int width, height;
919
+
920
+    /**
921
+     * number of audio samples (per channel) described by this frame
922
+     * - encoding: Set by user
923
+     * - decoding: Set by libavcodec
924
+     */
925
+    int nb_samples;
926
+
927
+    /**
928
+     * format of the frame, -1 if unknown or unset
929
+     * Values correspond to enum PixelFormat for video frames,
930
+     * enum AVSampleFormat for audio)
931
+     * - encoding: unused
932
+     * - decoding: Read by user.
933
+     */
934
+    int format;
935
+
900 936
     /**
901 937
      * 1 -> keyframe, 0-> not
902 938
      * - encoding: Set by libavcodec.
... ...
@@ -912,6 +948,21 @@ typedef struct AVFrame {
912 912
     enum AVPictureType pict_type;
913 913
 
914 914
     /**
915
+     * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
916
+     * This isn't used by libavcodec unless the default get/release_buffer() is used.
917
+     * - encoding:
918
+     * - decoding:
919
+     */
920
+    uint8_t *base[AV_NUM_DATA_POINTERS];
921
+
922
+    /**
923
+     * sample aspect ratio for the video frame, 0/1 if unknown\unspecified
924
+     * - encoding: unused
925
+     * - decoding: Read by user.
926
+     */
927
+    AVRational sample_aspect_ratio;
928
+
929
+    /**
915 930
      * presentation timestamp in time_base units (time when frame should be shown to user)
916 931
      * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
917 932
      * - encoding: MUST be set by user.
... ...
@@ -920,6 +971,20 @@ typedef struct AVFrame {
920 920
     int64_t pts;
921 921
 
922 922
     /**
923
+     * reordered pts from the last AVPacket that has been input into the decoder
924
+     * - encoding: unused
925
+     * - decoding: Read by user.
926
+     */
927
+    int64_t pkt_pts;
928
+
929
+    /**
930
+     * dts from the last AVPacket that has been input into the decoder
931
+     * - encoding: unused
932
+     * - decoding: Read by user.
933
+     */
934
+    int64_t pkt_dts;
935
+
936
+    /**
923 937
      * picture number in bitstream order
924 938
      * - encoding: set by
925 939
      * - decoding: Set by libavcodec.
... ...
@@ -963,6 +1028,11 @@ typedef struct AVFrame {
963 963
     int qstride;
964 964
 
965 965
     /**
966
+     *
967
+     */
968
+    int qscale_type;
969
+
970
+    /**
966 971
      * mbskip_table[mb]>=1 if MB didn't change
967 972
      * stride= mb_width = (width+15)>>4
968 973
      * - encoding: unused
... ...
@@ -993,12 +1063,19 @@ typedef struct AVFrame {
993 993
     uint32_t *mb_type;
994 994
 
995 995
     /**
996
-     * log2 of the size of the block which a single vector in motion_val represents:
997
-     * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
996
+     * DCT coefficients
998 997
      * - encoding: unused
999 998
      * - decoding: Set by libavcodec.
1000 999
      */
1001
-    uint8_t motion_subsample_log2;
1000
+    short *dct_coeff;
1001
+
1002
+    /**
1003
+     * motion reference frame index
1004
+     * the order in which these are stored can depend on the codec.
1005
+     * - encoding: Set by user.
1006
+     * - decoding: Set by libavcodec.
1007
+     */
1008
+    int8_t *ref_index[2];
1002 1009
 
1003 1010
     /**
1004 1011
      * for some private data of the user
... ...
@@ -1031,11 +1108,6 @@ typedef struct AVFrame {
1031 1031
     int repeat_pict;
1032 1032
 
1033 1033
     /**
1034
-     *
1035
-     */
1036
-    int qscale_type;
1037
-
1038
-    /**
1039 1034
      * The content of the picture is interlaced.
1040 1035
      * - encoding: Set by user.
1041 1036
      * - decoding: Set by libavcodec. (default 0)
... ...
@@ -1050,13 +1122,6 @@ typedef struct AVFrame {
1050 1050
     int top_field_first;
1051 1051
 
1052 1052
     /**
1053
-     * Pan scan.
1054
-     * - encoding: Set by user.
1055
-     * - decoding: Set by libavcodec.
1056
-     */
1057
-    AVPanScan *pan_scan;
1058
-
1059
-    /**
1060 1053
      * Tell user application that palette has changed from previous frame.
1061 1054
      * - encoding: ??? (no palette-enabled encoder yet)
1062 1055
      * - decoding: Set by libavcodec. (default 0).
... ...
@@ -1071,19 +1136,11 @@ typedef struct AVFrame {
1071 1071
     int buffer_hints;
1072 1072
 
1073 1073
     /**
1074
-     * DCT coefficients
1075
-     * - encoding: unused
1076
-     * - decoding: Set by libavcodec.
1077
-     */
1078
-    short *dct_coeff;
1079
-
1080
-    /**
1081
-     * motion reference frame index
1082
-     * the order in which these are stored can depend on the codec.
1074
+     * Pan scan.
1083 1075
      * - encoding: Set by user.
1084 1076
      * - decoding: Set by libavcodec.
1085 1077
      */
1086
-    int8_t *ref_index[2];
1078
+    AVPanScan *pan_scan;
1087 1079
 
1088 1080
     /**
1089 1081
      * reordered opaque 64bit (generally an integer or a double precision float
... ...
@@ -1106,20 +1163,6 @@ typedef struct AVFrame {
1106 1106
     void *hwaccel_picture_private;
1107 1107
 
1108 1108
     /**
1109
-     * reordered pts from the last AVPacket that has been input into the decoder
1110
-     * - encoding: unused
1111
-     * - decoding: Read by user.
1112
-     */
1113
-    int64_t pkt_pts;
1114
-
1115
-    /**
1116
-     * dts from the last AVPacket that has been input into the decoder
1117
-     * - encoding: unused
1118
-     * - decoding: Read by user.
1119
-     */
1120
-    int64_t pkt_dts;
1121
-
1122
-    /**
1123 1109
      * the AVCodecContext which ff_thread_get_buffer() was last called on
1124 1110
      * - encoding: Set by libavcodec.
1125 1111
      * - decoding: Set by libavcodec.
... ...
@@ -1134,54 +1177,12 @@ typedef struct AVFrame {
1134 1134
     void *thread_opaque;
1135 1135
 
1136 1136
     /**
1137
-     * number of audio samples (per channel) described by this frame
1138
-     * - encoding: Set by user
1139
-     * - decoding: Set by libavcodec
1140
-     */
1141
-    int nb_samples;
1142
-
1143
-    /**
1144
-     * pointers to the data planes/channels.
1145
-     *
1146
-     * For video, this should simply point to data[].
1147
-     *
1148
-     * For planar audio, each channel has a separate data pointer, and
1149
-     * linesize[0] contains the size of each channel buffer.
1150
-     * For packed audio, there is just one data pointer, and linesize[0]
1151
-     * contains the total size of the buffer for all channels.
1152
-     *
1153
-     * Note: Both data and extended_data will always be set by get_buffer(),
1154
-     * but for planar audio with more channels that can fit in data,
1155
-     * extended_data must be used by the decoder in order to access all
1156
-     * channels.
1157
-     *
1158
-     * encoding: unused
1159
-     * decoding: set by AVCodecContext.get_buffer()
1160
-     */
1161
-    uint8_t **extended_data;
1162
-
1163
-    /**
1164
-     * sample aspect ratio for the video frame, 0/1 if unknown\unspecified
1165
-     * - encoding: unused
1166
-     * - decoding: Read by user.
1167
-     */
1168
-    AVRational sample_aspect_ratio;
1169
-
1170
-    /**
1171
-     * width and height of the video frame
1172
-     * - encoding: unused
1173
-     * - decoding: Read by user.
1174
-     */
1175
-    int width, height;
1176
-
1177
-    /**
1178
-     * format of the frame, -1 if unknown or unset
1179
-     * Values correspond to enum PixelFormat for video frames,
1180
-     * enum AVSampleFormat for audio)
1137
+     * log2 of the size of the block which a single vector in motion_val represents:
1138
+     * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
1181 1139
      * - encoding: unused
1182
-     * - decoding: Read by user.
1140
+     * - decoding: Set by libavcodec.
1183 1141
      */
1184
-    int format;
1142
+    uint8_t motion_subsample_log2;
1185 1143
 
1186 1144
     /**
1187 1145
      * frame timestamp estimated using various heuristics, in stream time base
... ...
@@ -1200,7 +1201,6 @@ typedef struct AVFrame {
1200 1200
      * - decoding: Read by user.
1201 1201
      */
1202 1202
     int64_t pkt_pos;
1203
-
1204 1203
 } AVFrame;
1205 1204
 
1206 1205
 struct AVCodecInternal;
... ...
@@ -1229,6 +1229,63 @@ typedef struct AVCodecContext {
1229 1229
      * - set by avcodec_alloc_context3
1230 1230
      */
1231 1231
     const AVClass *av_class;
1232
+    int log_level_offset;
1233
+
1234
+    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1235
+    struct AVCodec  *codec;
1236
+    char             codec_name[32];
1237
+    enum CodecID     codec_id; /* see CODEC_ID_xxx */
1238
+
1239
+    /**
1240
+     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1241
+     * This is used to work around some encoder bugs.
1242
+     * A demuxer should set this to what is stored in the field used to identify the codec.
1243
+     * If there are multiple such fields in a container then the demuxer should choose the one
1244
+     * which maximizes the information about the used codec.
1245
+     * If the codec tag field in a container is larger than 32 bits then the demuxer should
1246
+     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1247
+     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1248
+     * first.
1249
+     * - encoding: Set by user, if not then the default based on codec_id will be used.
1250
+     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1251
+     */
1252
+    unsigned int codec_tag;
1253
+
1254
+    /**
1255
+     * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1256
+     * This is used to work around some encoder bugs.
1257
+     * - encoding: unused
1258
+     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1259
+     */
1260
+    unsigned int stream_codec_tag;
1261
+
1262
+    /**
1263
+     * Some codecs need additional format info. It is stored here.
1264
+     * If any muxer uses this then ALL demuxers/parsers AND encoders for the
1265
+     * specific codec MUST set it correctly otherwise stream copy breaks.
1266
+     * In general use of this field by muxers is not recommended.
1267
+     * - encoding: Set by libavcodec.
1268
+     * - decoding: Set by libavcodec. (FIXME: Is this OK?)
1269
+     */
1270
+    int sub_id;
1271
+
1272
+    void *priv_data;
1273
+
1274
+    /**
1275
+     * Private context used for internal data.
1276
+     *
1277
+     * Unlike priv_data, this is not codec-specific. It is used in general
1278
+     * libavcodec functions.
1279
+     */
1280
+    struct AVCodecInternal *internal;
1281
+
1282
+    /**
1283
+     * Private data of the user, can be used to carry app specific stuff.
1284
+     * - encoding: Set by user.
1285
+     * - decoding: Set by user.
1286
+     */
1287
+    void *opaque;
1288
+
1232 1289
     /**
1233 1290
      * the average bitrate
1234 1291
      * - encoding: Set by user; unused for constant quantizer encoding.
... ...
@@ -1245,30 +1302,33 @@ typedef struct AVCodecContext {
1245 1245
     int bit_rate_tolerance;
1246 1246
 
1247 1247
     /**
1248
-     * CODEC_FLAG_*.
1248
+     * Global quality for codecs which cannot change it per frame.
1249
+     * This should be proportional to MPEG-1/2/4 qscale.
1249 1250
      * - encoding: Set by user.
1250
-     * - decoding: Set by user.
1251
+     * - decoding: unused
1251 1252
      */
1252
-    int flags;
1253
+    int global_quality;
1253 1254
 
1254 1255
     /**
1255
-     * Some codecs need additional format info. It is stored here.
1256
-     * If any muxer uses this then ALL demuxers/parsers AND encoders for the
1257
-     * specific codec MUST set it correctly otherwise stream copy breaks.
1258
-     * In general use of this field by muxers is not recommended.
1259
-     * - encoding: Set by libavcodec.
1260
-     * - decoding: Set by libavcodec. (FIXME: Is this OK?)
1256
+     * - encoding: Set by user.
1257
+     * - decoding: unused
1261 1258
      */
1262
-    int sub_id;
1259
+    int compression_level;
1260
+#define FF_COMPRESSION_DEFAULT -1
1263 1261
 
1264 1262
     /**
1265
-     * Motion estimation algorithm used for video coding.
1266
-     * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
1267
-     * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
1268
-     * - encoding: MUST be set by user.
1269
-     * - decoding: unused
1263
+     * CODEC_FLAG_*.
1264
+     * - encoding: Set by user.
1265
+     * - decoding: Set by user.
1270 1266
      */
1271
-    int me_method;
1267
+    int flags;
1268
+
1269
+    /**
1270
+     * CODEC_FLAG2_*
1271
+     * - encoding: Set by user.
1272
+     * - decoding: Set by user.
1273
+     */
1274
+    int flags2;
1272 1275
 
1273 1276
     /**
1274 1277
      * some codecs need / can use extradata like Huffman tables.
... ...
@@ -1294,6 +1354,39 @@ typedef struct AVCodecContext {
1294 1294
      */
1295 1295
     AVRational time_base;
1296 1296
 
1297
+    /**
1298
+     * For some codecs, the time base is closer to the field rate than the frame rate.
1299
+     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
1300
+     * if no telecine is used ...
1301
+     *
1302
+     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
1303
+     */
1304
+    int ticks_per_frame;
1305
+
1306
+    /**
1307
+     * Encoding: Number of frames delay there will be from the encoder input to
1308
+     *           the decoder output. (we assume the decoder matches the spec)
1309
+     * Decoding: Number of frames delay in addition to what a standard decoder
1310
+     *           as specified in the spec would produce.
1311
+     *
1312
+     * Video:
1313
+     *   Number of frames the decoded output will be delayed relative to the
1314
+     *   encoded input.
1315
+     *
1316
+     * Audio:
1317
+     *   Number of "priming" samples added to the beginning of the stream
1318
+     *   during encoding. The decoded output will be delayed by this many
1319
+     *   samples relative to the input to the encoder. Note that this field is
1320
+     *   purely informational and does not directly affect the pts output by
1321
+     *   the encoder, which should always be based on the actual presentation
1322
+     *   time, including any delay.
1323
+     *
1324
+     * - encoding: Set by libavcodec.
1325
+     * - decoding: Set by libavcodec.
1326
+     */
1327
+    int delay;
1328
+
1329
+
1297 1330
     /* video only */
1298 1331
     /**
1299 1332
      * picture width / height.
... ...
@@ -1304,6 +1397,13 @@ typedef struct AVCodecContext {
1304 1304
      */
1305 1305
     int width, height;
1306 1306
 
1307
+    /**
1308
+     * Bitstream width / height, may be different from width/height if lowres enabled.
1309
+     * - encoding: unused
1310
+     * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
1311
+     */
1312
+    int coded_width, coded_height;
1313
+
1307 1314
 #define FF_ASPECT_EXTENDED 15
1308 1315
 
1309 1316
     /**
... ...
@@ -1323,6 +1423,15 @@ typedef struct AVCodecContext {
1323 1323
     enum PixelFormat pix_fmt;
1324 1324
 
1325 1325
     /**
1326
+     * Motion estimation algorithm used for video coding.
1327
+     * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
1328
+     * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
1329
+     * - encoding: MUST be set by user.
1330
+     * - decoding: unused
1331
+     */
1332
+    int me_method;
1333
+
1334
+    /**
1326 1335
      * If non NULL, 'draw_horiz_band' is called by the libavcodec
1327 1336
      * decoder to draw a horizontal band. It improves cache usage. Not
1328 1337
      * all codecs can do that. You must check the codec capabilities
... ...
@@ -1349,71 +1458,16 @@ typedef struct AVCodecContext {
1349 1349
                             const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1350 1350
                             int y, int type, int height);
1351 1351
 
1352
-    /* audio only */
1353
-    int sample_rate; ///< samples per second
1354
-    int channels;    ///< number of audio channels
1355
-
1356
-    /**
1357
-     * audio sample format
1358
-     * - encoding: Set by user.
1359
-     * - decoding: Set by libavcodec.
1360
-     */
1361
-    enum AVSampleFormat sample_fmt;  ///< sample format
1362
-
1363
-    /* The following data should not be initialized. */
1364 1352
     /**
1365
-     * Samples per packet, initialized when calling 'init'.
1366
-     */
1367
-    int frame_size;
1368
-    int frame_number;   ///< audio or video frame number
1369
-
1370
-    /**
1371
-     * Encoding: Number of frames delay there will be from the encoder input to
1372
-     *           the decoder output. (we assume the decoder matches the spec)
1373
-     * Decoding: Number of frames delay in addition to what a standard decoder
1374
-     *           as specified in the spec would produce.
1375
-     *
1376
-     * Video:
1377
-     *   Number of frames the decoded output will be delayed relative to the
1378
-     *   encoded input.
1379
-     *
1380
-     * Audio:
1381
-     *   Number of "priming" samples added to the beginning of the stream
1382
-     *   during encoding. The decoded output will be delayed by this many
1383
-     *   samples relative to the input to the encoder. Note that this field is
1384
-     *   purely informational and does not directly affect the pts output by
1385
-     *   the encoder, which should always be based on the actual presentation
1386
-     *   time, including any delay.
1387
-     *
1388
-     * - encoding: Set by libavcodec.
1389
-     * - decoding: Set by libavcodec.
1390
-     */
1391
-    int delay;
1392
-
1393
-    /* - encoding parameters */
1394
-    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
1395
-    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
1396
-
1397
-    /**
1398
-     * minimum quantizer
1399
-     * - encoding: Set by user.
1400
-     * - decoding: unused
1401
-     */
1402
-    int qmin;
1403
-
1404
-    /**
1405
-     * maximum quantizer
1406
-     * - encoding: Set by user.
1407
-     * - decoding: unused
1408
-     */
1409
-    int qmax;
1410
-
1411
-    /**
1412
-     * maximum quantizer difference between frames
1413
-     * - encoding: Set by user.
1414
-     * - decoding: unused
1353
+     * callback to negotiate the pixelFormat
1354
+     * @param fmt is the list of formats which are supported by the codec,
1355
+     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1356
+     * The first is always the native one.
1357
+     * @return the chosen format
1358
+     * - encoding: unused
1359
+     * - decoding: Set by user, if not set the native format will be chosen.
1415 1360
      */
1416
-    int max_qdiff;
1361
+    enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
1417 1362
 
1418 1363
     /**
1419 1364
      * maximum number of B-frames between non-B-frames
... ...
@@ -1438,92 +1492,6 @@ typedef struct AVCodecContext {
1438 1438
 
1439 1439
     int b_frame_strategy;
1440 1440
 
1441
-    struct AVCodec *codec;
1442
-
1443
-    void *priv_data;
1444
-
1445
-    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
1446
-                            /* do its best to deliver a chunk with size     */
1447
-                            /* below rtp_payload_size, the chunk will start */
1448
-                            /* with a start code on some codecs like H.263. */
1449
-                            /* This doesn't take account of any particular  */
1450
-                            /* headers inside the transmitted RTP payload.  */
1451
-
1452
-
1453
-    /* The RTP callback: This function is called    */
1454
-    /* every time the encoder has a packet to send. */
1455
-    /* It depends on the encoder if the data starts */
1456
-    /* with a Start Code (it should). H.263 does.   */
1457
-    /* mb_nb contains the number of macroblocks     */
1458
-    /* encoded in the RTP payload.                  */
1459
-    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
1460
-
1461
-    /* statistics, used for 2-pass encoding */
1462
-    int mv_bits;
1463
-    int header_bits;
1464
-    int i_tex_bits;
1465
-    int p_tex_bits;
1466
-    int i_count;
1467
-    int p_count;
1468
-    int skip_count;
1469
-    int misc_bits;
1470
-
1471
-    /**
1472
-     * number of bits used for the previously encoded frame
1473
-     * - encoding: Set by libavcodec.
1474
-     * - decoding: unused
1475
-     */
1476
-    int frame_bits;
1477
-
1478
-    /**
1479
-     * Private data of the user, can be used to carry app specific stuff.
1480
-     * - encoding: Set by user.
1481
-     * - decoding: Set by user.
1482
-     */
1483
-    void *opaque;
1484
-
1485
-    char codec_name[32];
1486
-    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1487
-    enum CodecID codec_id; /* see CODEC_ID_xxx */
1488
-
1489
-    /**
1490
-     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1491
-     * This is used to work around some encoder bugs.
1492
-     * A demuxer should set this to what is stored in the field used to identify the codec.
1493
-     * If there are multiple such fields in a container then the demuxer should choose the one
1494
-     * which maximizes the information about the used codec.
1495
-     * If the codec tag field in a container is larger than 32 bits then the demuxer should
1496
-     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1497
-     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1498
-     * first.
1499
-     * - encoding: Set by user, if not then the default based on codec_id will be used.
1500
-     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1501
-     */
1502
-    unsigned int codec_tag;
1503
-
1504
-    /**
1505
-     * Work around bugs in encoders which sometimes cannot be detected automatically.
1506
-     * - encoding: Set by user
1507
-     * - decoding: Set by user
1508
-     */
1509
-    int workaround_bugs;
1510
-#define FF_BUG_AUTODETECT       1  ///< autodetection
1511
-#define FF_BUG_OLD_MSMPEG4      2
1512
-#define FF_BUG_XVID_ILACE       4
1513
-#define FF_BUG_UMP4             8
1514
-#define FF_BUG_NO_PADDING       16
1515
-#define FF_BUG_AMV              32
1516
-#define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
1517
-#define FF_BUG_QPEL_CHROMA      64
1518
-#define FF_BUG_STD_QPEL         128
1519
-#define FF_BUG_QPEL_CHROMA2     256
1520
-#define FF_BUG_DIRECT_BLOCKSIZE 512
1521
-#define FF_BUG_EDGE             1024
1522
-#define FF_BUG_HPEL_CHROMA      2048
1523
-#define FF_BUG_DC_CLIP          4096
1524
-#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
1525
-#define FF_BUG_TRUNCATED       16384
1526
-
1527 1441
     /**
1528 1442
      * luma single coefficient elimination threshold
1529 1443
      * - encoding: Set by user.
... ...
@@ -1539,25 +1507,6 @@ typedef struct AVCodecContext {
1539 1539
     int chroma_elim_threshold;
1540 1540
 
1541 1541
     /**
1542
-     * strictly follow the standard (MPEG4, ...).
1543
-     * - encoding: Set by user.
1544
-     * - decoding: Set by user.
1545
-     * Setting this to STRICT or higher means the encoder and decoder will
1546
-     * generally do stupid things, whereas setting it to unofficial or lower
1547
-     * will mean the encoder might produce output that is not supported by all
1548
-     * spec-compliant decoders. Decoders don't differentiate between normal,
1549
-     * unofficial and experimental (that is, they always try to decode things
1550
-     * when they can) unless they are explicitly asked to behave stupidly
1551
-     * (=strictly conform to the specs)
1552
-     */
1553
-    int strict_std_compliance;
1554
-#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
1555
-#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
1556
-#define FF_COMPLIANCE_NORMAL        0
1557
-#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
1558
-#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
1559
-
1560
-    /**
1561 1542
      * qscale offset between IP and B-frames
1562 1543
      * - encoding: Set by user.
1563 1544
      * - decoding: unused
... ...
@@ -1565,74 +1514,6 @@ typedef struct AVCodecContext {
1565 1565
     float b_quant_offset;
1566 1566
 
1567 1567
     /**
1568
-     * Called at the beginning of each frame to get a buffer for it.
1569
-     *
1570
-     * The function will set AVFrame.data[], AVFrame.linesize[].
1571
-     * AVFrame.extended_data[] must also be set, but it should be the same as
1572
-     * AVFrame.data[] except for planar audio with more channels than can fit
1573
-     * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
1574
-     * many data pointers as it can hold.
1575
-     *
1576
-     * if CODEC_CAP_DR1 is not set then get_buffer() must call
1577
-     * avcodec_default_get_buffer() instead of providing buffers allocated by
1578
-     * some other means.
1579
-     *
1580
-     * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
1581
-     * need it. avcodec_default_get_buffer() aligns the output buffer properly,
1582
-     * but if get_buffer() is overridden then alignment considerations should
1583
-     * be taken into account.
1584
-     *
1585
-     * @see avcodec_default_get_buffer()
1586
-     *
1587
-     * Video:
1588
-     *
1589
-     * If pic.reference is set then the frame will be read later by libavcodec.
1590
-     * avcodec_align_dimensions2() should be used to find the required width and
1591
-     * height, as they normally need to be rounded up to the next multiple of 16.
1592
-     *
1593
-     * If frame multithreading is used and thread_safe_callbacks is set,
1594
-     * it may be called from a different thread, but not from more than one at
1595
-     * once. Does not need to be reentrant.
1596
-     *
1597
-     * @see release_buffer(), reget_buffer()
1598
-     * @see avcodec_align_dimensions2()
1599
-     *
1600
-     * Audio:
1601
-     *
1602
-     * Decoders request a buffer of a particular size by setting
1603
-     * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
1604
-     * however, utilize only part of the buffer by setting AVFrame.nb_samples
1605
-     * to a smaller value in the output frame.
1606
-     *
1607
-     * Decoders cannot use the buffer after returning from
1608
-     * avcodec_decode_audio4(), so they will not call release_buffer(), as it
1609
-     * is assumed to be released immediately upon return.
1610
-     *
1611
-     * As a convenience, av_samples_get_buffer_size() and
1612
-     * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
1613
-     * functions to find the required data size and to fill data pointers and
1614
-     * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
1615
-     * since all planes must be the same size.
1616
-     *
1617
-     * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
1618
-     *
1619
-     * - encoding: unused
1620
-     * - decoding: Set by libavcodec, user can override.
1621
-     */
1622
-    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
1623
-
1624
-    /**
1625
-     * Called to release buffers which were allocated with get_buffer.
1626
-     * A released buffer can be reused in get_buffer().
1627
-     * pic.data[*] must be set to NULL.
1628
-     * May be called from a different thread if frame multithreading is used,
1629
-     * but not by more than one thread at once, so does not need to be reentrant.
1630
-     * - encoding: unused
1631
-     * - decoding: Set by libavcodec, user can override.
1632
-     */
1633
-    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1634
-
1635
-    /**
1636 1568
      * Size of the frame reordering buffer in the decoder.
1637 1569
      * For MPEG-2 it is 1 IPB or 0 low delay IP.
1638 1570
      * - encoding: Set by libavcodec.
... ...
@@ -1641,12 +1522,6 @@ typedef struct AVCodecContext {
1641 1641
     int has_b_frames;
1642 1642
 
1643 1643
     /**
1644
-     * number of bytes per packet if constant and known or 0
1645
-     * Used by some WAV based audio codecs.
1646
-     */
1647
-    int block_align;
1648
-
1649
-    /**
1650 1644
      * 0-> h263 quant 1-> mpeg quant
1651 1645
      * - encoding: Set by user.
1652 1646
      * - decoding: unused
... ...
@@ -1654,69 +1529,6 @@ typedef struct AVCodecContext {
1654 1654
     int mpeg_quant;
1655 1655
 
1656 1656
     /**
1657
-     * pass1 encoding statistics output buffer
1658
-     * - encoding: Set by libavcodec.
1659
-     * - decoding: unused
1660
-     */
1661
-    char *stats_out;
1662
-
1663
-    /**
1664
-     * pass2 encoding statistics input buffer
1665
-     * Concatenated stuff from stats_out of pass1 should be placed here.
1666
-     * - encoding: Allocated/set/freed by user.
1667
-     * - decoding: unused
1668
-     */
1669
-    char *stats_in;
1670
-
1671
-    /**
1672
-     * ratecontrol qmin qmax limiting method
1673
-     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
1674
-     * - encoding: Set by user.
1675
-     * - decoding: unused
1676
-     */
1677
-    float rc_qsquish;
1678
-
1679
-    float rc_qmod_amp;
1680
-    int rc_qmod_freq;
1681
-
1682
-    /**
1683
-     * ratecontrol override, see RcOverride
1684
-     * - encoding: Allocated/set/freed by user.
1685
-     * - decoding: unused
1686
-     */
1687
-    RcOverride *rc_override;
1688
-    int rc_override_count;
1689
-
1690
-    /**
1691
-     * rate control equation
1692
-     * - encoding: Set by user
1693
-     * - decoding: unused
1694
-     */
1695
-    const char *rc_eq;
1696
-
1697
-    /**
1698
-     * maximum bitrate
1699
-     * - encoding: Set by user.
1700
-     * - decoding: unused
1701
-     */
1702
-    int rc_max_rate;
1703
-
1704
-    /**
1705
-     * minimum bitrate
1706
-     * - encoding: Set by user.
1707
-     * - decoding: unused
1708
-     */
1709
-    int rc_min_rate;
1710
-
1711
-    /**
1712
-     * decoder bitstream buffer size
1713
-     * - encoding: Set by user.
1714
-     * - decoding: unused
1715
-     */
1716
-    int rc_buffer_size;
1717
-    float rc_buffer_aggressivity;
1718
-
1719
-    /**
1720 1657
      * qscale factor between P and I-frames
1721 1658
      * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1722 1659
      * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
... ...
@@ -1733,26 +1545,6 @@ typedef struct AVCodecContext {
1733 1733
     float i_quant_offset;
1734 1734
 
1735 1735
     /**
1736
-     * initial complexity for pass1 ratecontrol
1737
-     * - encoding: Set by user.
1738
-     * - decoding: unused
1739
-     */
1740
-    float rc_initial_cplx;
1741
-
1742
-    /**
1743
-     * DCT algorithm, see FF_DCT_* below
1744
-     * - encoding: Set by user.
1745
-     * - decoding: unused
1746
-     */
1747
-    int dct_algo;
1748
-#define FF_DCT_AUTO    0
1749
-#define FF_DCT_FASTINT 1
1750
-#define FF_DCT_INT     2
1751
-#define FF_DCT_MMX     3
1752
-#define FF_DCT_ALTIVEC 5
1753
-#define FF_DCT_FAAN    6
1754
-
1755
-    /**
1756 1736
      * luminance masking (0-> disabled)
1757 1737
      * - encoding: Set by user.
1758 1738
      * - decoding: unused
... ...
@@ -1788,76 +1580,12 @@ typedef struct AVCodecContext {
1788 1788
     float dark_masking;
1789 1789
 
1790 1790
     /**
1791
-     * IDCT algorithm, see FF_IDCT_* below.
1792
-     * - encoding: Set by user.
1793
-     * - decoding: Set by user.
1794
-     */
1795
-    int idct_algo;
1796
-#define FF_IDCT_AUTO          0
1797
-#define FF_IDCT_INT           1
1798
-#define FF_IDCT_SIMPLE        2
1799
-#define FF_IDCT_SIMPLEMMX     3
1800
-#define FF_IDCT_LIBMPEG2MMX   4
1801
-#define FF_IDCT_MMI           5
1802
-#define FF_IDCT_ARM           7
1803
-#define FF_IDCT_ALTIVEC       8
1804
-#define FF_IDCT_SH4           9
1805
-#define FF_IDCT_SIMPLEARM     10
1806
-#define FF_IDCT_H264          11
1807
-#define FF_IDCT_VP3           12
1808
-#define FF_IDCT_IPP           13
1809
-#define FF_IDCT_XVIDMMX       14
1810
-#define FF_IDCT_CAVS          15
1811
-#define FF_IDCT_SIMPLEARMV5TE 16
1812
-#define FF_IDCT_SIMPLEARMV6   17
1813
-#define FF_IDCT_SIMPLEVIS     18
1814
-#define FF_IDCT_WMV2          19
1815
-#define FF_IDCT_FAAN          20
1816
-#define FF_IDCT_EA            21
1817
-#define FF_IDCT_SIMPLENEON    22
1818
-#define FF_IDCT_SIMPLEALPHA   23
1819
-#define FF_IDCT_BINK          24
1820
-
1821
-    /**
1822 1791
      * slice count
1823 1792
      * - encoding: Set by libavcodec.
1824 1793
      * - decoding: Set by user (or 0).
1825 1794
      */
1826 1795
     int slice_count;
1827 1796
     /**
1828
-     * slice offsets in the frame in bytes
1829
-     * - encoding: Set/allocated by libavcodec.
1830
-     * - decoding: Set/allocated by user (or NULL).
1831
-     */
1832
-    int *slice_offset;
1833
-
1834
-    /**
1835
-     * error concealment flags
1836
-     * - encoding: unused
1837
-     * - decoding: Set by user.
1838
-     */
1839
-    int error_concealment;
1840
-#define FF_EC_GUESS_MVS   1
1841
-#define FF_EC_DEBLOCK     2
1842
-
1843
-    /**
1844
-     * dsp_mask could be add used to disable unwanted CPU features
1845
-     * CPU features (i.e. MMX, SSE. ...)
1846
-     *
1847
-     * With the FORCE flag you may instead enable given CPU features.
1848
-     * (Dangerous: Usable in case of misdetection, improper usage however will
1849
-     * result into program crash.)
1850
-     */
1851
-    unsigned dsp_mask;
1852
-
1853
-    /**
1854
-     * bits per sample/pixel from the demuxer (needed for huffyuv).
1855
-     * - encoding: Set by libavcodec.
1856
-     * - decoding: Set by user.
1857
-     */
1858
-     int bits_per_coded_sample;
1859
-
1860
-    /**
1861 1797
      * prediction method (needed for huffyuv)
1862 1798
      * - encoding: Set by user.
1863 1799
      * - decoding: unused
... ...
@@ -1868,6 +1596,13 @@ typedef struct AVCodecContext {
1868 1868
 #define FF_PRED_MEDIAN 2
1869 1869
 
1870 1870
     /**
1871
+     * slice offsets in the frame in bytes
1872
+     * - encoding: Set/allocated by libavcodec.
1873
+     * - decoding: Set/allocated by user (or NULL).
1874
+     */
1875
+    int *slice_offset;
1876
+
1877
+    /**
1871 1878
      * sample aspect ratio (0 if unknown)
1872 1879
      * That is the width of a pixel divided by the height of the pixel.
1873 1880
      * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
... ...
@@ -1877,54 +1612,6 @@ typedef struct AVCodecContext {
1877 1877
     AVRational sample_aspect_ratio;
1878 1878
 
1879 1879
     /**
1880
-     * the picture in the bitstream
1881
-     * - encoding: Set by libavcodec.
1882
-     * - decoding: Set by libavcodec.
1883
-     */
1884
-    AVFrame *coded_frame;
1885
-
1886
-    /**
1887
-     * debug
1888
-     * - encoding: Set by user.
1889
-     * - decoding: Set by user.
1890
-     */
1891
-    int debug;
1892
-#define FF_DEBUG_PICT_INFO   1
1893
-#define FF_DEBUG_RC          2
1894
-#define FF_DEBUG_BITSTREAM   4
1895
-#define FF_DEBUG_MB_TYPE     8
1896
-#define FF_DEBUG_QP          16
1897
-#define FF_DEBUG_MV          32
1898
-#define FF_DEBUG_DCT_COEFF   0x00000040
1899
-#define FF_DEBUG_SKIP        0x00000080
1900
-#define FF_DEBUG_STARTCODE   0x00000100
1901
-#define FF_DEBUG_PTS         0x00000200
1902
-#define FF_DEBUG_ER          0x00000400
1903
-#define FF_DEBUG_MMCO        0x00000800
1904
-#define FF_DEBUG_BUGS        0x00001000
1905
-#define FF_DEBUG_VIS_QP      0x00002000
1906
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000
1907
-#define FF_DEBUG_BUFFERS     0x00008000
1908
-#define FF_DEBUG_THREADS     0x00010000
1909
-
1910
-    /**
1911
-     * debug
1912
-     * - encoding: Set by user.
1913
-     * - decoding: Set by user.
1914
-     */
1915
-    int debug_mv;
1916
-#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
1917
-#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
1918
-#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
1919
-
1920
-    /**
1921
-     * error
1922
-     * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
1923
-     * - decoding: unused
1924
-     */
1925
-    uint64_t error[AV_NUM_DATA_POINTERS];
1926
-
1927
-    /**
1928 1880
      * motion estimation comparison function
1929 1881
      * - encoding: Set by user.
1930 1882
      * - decoding: unused
... ...
@@ -2008,17 +1695,6 @@ typedef struct AVCodecContext {
2008 2008
     int me_subpel_quality;
2009 2009
 
2010 2010
     /**
2011
-     * callback to negotiate the pixelFormat
2012
-     * @param fmt is the list of formats which are supported by the codec,
2013
-     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2014
-     * The first is always the native one.
2015
-     * @return the chosen format
2016
-     * - encoding: unused
2017
-     * - decoding: Set by user, if not set the native format will be chosen.
2018
-     */
2019
-    enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
2020
-
2021
-    /**
2022 2011
      * DTG active format information (additional aspect ratio
2023 2012
      * information only used in DVB MPEG-2 transport streams)
2024 2013
      * 0 if not set.
... ...
@@ -2068,33 +1744,6 @@ typedef struct AVCodecContext {
2068 2068
     int color_table_id;
2069 2069
 
2070 2070
     /**
2071
-     * Global quality for codecs which cannot change it per frame.
2072
-     * This should be proportional to MPEG-1/2/4 qscale.
2073
-     * - encoding: Set by user.
2074
-     * - decoding: unused
2075
-     */
2076
-    int global_quality;
2077
-
2078
-#define FF_CODER_TYPE_VLC       0
2079
-#define FF_CODER_TYPE_AC        1
2080
-#define FF_CODER_TYPE_RAW       2
2081
-#define FF_CODER_TYPE_RLE       3
2082
-#define FF_CODER_TYPE_DEFLATE   4
2083
-    /**
2084
-     * coder type
2085
-     * - encoding: Set by user.
2086
-     * - decoding: unused
2087
-     */
2088
-    int coder_type;
2089
-
2090
-    /**
2091
-     * context model
2092
-     * - encoding: Set by user.
2093
-     * - decoding: unused
2094
-     */
2095
-    int context_model;
2096
-
2097
-    /**
2098 2071
      * slice flags
2099 2072
      * - encoding: unused
2100 2073
      * - decoding: Set by user.
... ...
@@ -2136,14 +1785,6 @@ typedef struct AVCodecContext {
2136 2136
     uint16_t *inter_matrix;
2137 2137
 
2138 2138
     /**
2139
-     * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2140
-     * This is used to work around some encoder bugs.
2141
-     * - encoding: unused
2142
-     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2143
-     */
2144
-    unsigned int stream_codec_tag;
2145
-
2146
-    /**
2147 2139
      * scene change detection threshold
2148 2140
      * 0 is default, larger means fewer detected scene changes.
2149 2141
      * - encoding: Set by user.
... ...
@@ -2152,389 +1793,521 @@ typedef struct AVCodecContext {
2152 2152
     int scenechange_threshold;
2153 2153
 
2154 2154
     /**
2155
-     * minimum Lagrange multipler
2155
+     * noise reduction strength
2156 2156
      * - encoding: Set by user.
2157 2157
      * - decoding: unused
2158 2158
      */
2159
-    int lmin;
2159
+    int noise_reduction;
2160 2160
 
2161 2161
     /**
2162
-     * maximum Lagrange multipler
2162
+     *
2163 2163
      * - encoding: Set by user.
2164 2164
      * - decoding: unused
2165 2165
      */
2166
-    int lmax;
2166
+    int inter_threshold;
2167 2167
 
2168 2168
     /**
2169
-     * noise reduction strength
2169
+     * quantizer noise shaping
2170 2170
      * - encoding: Set by user.
2171 2171
      * - decoding: unused
2172 2172
      */
2173
-    int noise_reduction;
2173
+    int quantizer_noise_shaping;
2174 2174
 
2175 2175
     /**
2176
-     * Called at the beginning of a frame to get cr buffer for it.
2177
-     * Buffer type (size, hints) must be the same. libavcodec won't check it.
2178
-     * libavcodec will pass previous buffer in pic, function should return
2179
-     * same buffer or new buffer with old frame "painted" into it.
2180
-     * If pic.data[0] == NULL must behave like get_buffer().
2181
-     * if CODEC_CAP_DR1 is not set then reget_buffer() must call
2182
-     * avcodec_default_reget_buffer() instead of providing buffers allocated by
2183
-     * some other means.
2184
-     * - encoding: unused
2185
-     * - decoding: Set by libavcodec, user can override.
2176
+     * Motion estimation threshold below which no motion estimation is
2177
+     * performed, but instead the user specified motion vectors are used.
2178
+     *
2179
+     * - encoding: Set by user.
2180
+     * - decoding: unused
2186 2181
      */
2187
-    int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
2182
+    int me_threshold;
2188 2183
 
2189 2184
     /**
2190
-     * Number of bits which should be loaded into the rc buffer before decoding starts.
2185
+     * Macroblock threshold below which the user specified macroblock types will be used.
2191 2186
      * - encoding: Set by user.
2192 2187
      * - decoding: unused
2193 2188
      */
2194
-    int rc_initial_buffer_occupancy;
2189
+    int mb_threshold;
2195 2190
 
2196 2191
     /**
2197
-     *
2192
+     * precision of the intra DC coefficient - 8
2198 2193
      * - encoding: Set by user.
2199 2194
      * - decoding: unused
2200 2195
      */
2201
-    int inter_threshold;
2196
+    int intra_dc_precision;
2202 2197
 
2203 2198
     /**
2204
-     * CODEC_FLAG2_*
2205
-     * - encoding: Set by user.
2199
+     * Number of macroblock rows at the top which are skipped.
2200
+     * - encoding: unused
2206 2201
      * - decoding: Set by user.
2207 2202
      */
2208
-    int flags2;
2203
+    int skip_top;
2209 2204
 
2210 2205
     /**
2211
-     * Simulates errors in the bitstream to test error concealment.
2206
+     * Number of macroblock rows at the bottom which are skipped.
2207
+     * - encoding: unused
2208
+     * - decoding: Set by user.
2209
+     */
2210
+    int skip_bottom;
2211
+
2212
+    /**
2213
+     * Border processing masking, raises the quantizer for mbs on the borders
2214
+     * of the picture.
2212 2215
      * - encoding: Set by user.
2213 2216
      * - decoding: unused
2214 2217
      */
2215
-    int error_rate;
2218
+    float border_masking;
2216 2219
 
2217 2220
     /**
2218
-     * quantizer noise shaping
2221
+     * minimum MB lagrange multipler
2219 2222
      * - encoding: Set by user.
2220 2223
      * - decoding: unused
2221 2224
      */
2222
-    int quantizer_noise_shaping;
2225
+    int mb_lmin;
2223 2226
 
2224 2227
     /**
2225
-     * thread count
2226
-     * is used to decide how many independent tasks should be passed to execute()
2228
+     * maximum MB lagrange multipler
2227 2229
      * - encoding: Set by user.
2228
-     * - decoding: Set by user.
2230
+     * - decoding: unused
2229 2231
      */
2230
-    int thread_count;
2232
+    int mb_lmax;
2231 2233
 
2232 2234
     /**
2233
-     * The codec may call this to execute several independent things.
2234
-     * It will return only after finishing all tasks.
2235
-     * The user may replace this with some multithreaded implementation,
2236
-     * the default implementation will execute the parts serially.
2237
-     * @param count the number of things to execute
2238
-     * - encoding: Set by libavcodec, user can override.
2239
-     * - decoding: Set by libavcodec, user can override.
2235
+     *
2236
+     * - encoding: Set by user.
2237
+     * - decoding: unused
2240 2238
      */
2241
-    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
2239
+    int me_penalty_compensation;
2242 2240
 
2243 2241
     /**
2244
-     * thread opaque
2245
-     * Can be used by execute() to store some per AVCodecContext stuff.
2246
-     * - encoding: set by execute()
2247
-     * - decoding: set by execute()
2242
+     *
2243
+     * - encoding: Set by user.
2244
+     * - decoding: unused
2248 2245
      */
2249
-    void *thread_opaque;
2246
+    int bidir_refine;
2250 2247
 
2251 2248
     /**
2252
-     * Motion estimation threshold below which no motion estimation is
2253
-     * performed, but instead the user specified motion vectors are used.
2254 2249
      *
2255 2250
      * - encoding: Set by user.
2256 2251
      * - decoding: unused
2257 2252
      */
2258
-     int me_threshold;
2253
+    int brd_scale;
2259 2254
 
2260 2255
     /**
2261
-     * Macroblock threshold below which the user specified macroblock types will be used.
2256
+     * minimum GOP size
2262 2257
      * - encoding: Set by user.
2263 2258
      * - decoding: unused
2264 2259
      */
2265
-     int mb_threshold;
2260
+    int keyint_min;
2266 2261
 
2267 2262
     /**
2268
-     * precision of the intra DC coefficient - 8
2263
+     * number of reference frames
2269 2264
      * - encoding: Set by user.
2270
-     * - decoding: unused
2265
+     * - decoding: Set by lavc.
2271 2266
      */
2272
-     int intra_dc_precision;
2267
+    int refs;
2273 2268
 
2274 2269
     /**
2275
-     * noise vs. sse weight for the nsse comparsion function
2270
+     * chroma qp offset from luma
2276 2271
      * - encoding: Set by user.
2277 2272
      * - decoding: unused
2278 2273
      */
2279
-     int nsse_weight;
2274
+    int chromaoffset;
2280 2275
 
2281 2276
     /**
2282
-     * Number of macroblock rows at the top which are skipped.
2283
-     * - encoding: unused
2284
-     * - decoding: Set by user.
2277
+     * Multiplied by qscale for each frame and added to scene_change_score.
2278
+     * - encoding: Set by user.
2279
+     * - decoding: unused
2285 2280
      */
2286
-     int skip_top;
2281
+    int scenechange_factor;
2287 2282
 
2288 2283
     /**
2289
-     * Number of macroblock rows at the bottom which are skipped.
2290
-     * - encoding: unused
2291
-     * - decoding: Set by user.
2284
+     *
2285
+     * Note: Value depends upon the compare function used for fullpel ME.
2286
+     * - encoding: Set by user.
2287
+     * - decoding: unused
2292 2288
      */
2293
-     int skip_bottom;
2289
+    int mv0_threshold;
2294 2290
 
2295 2291
     /**
2296
-     * profile
2292
+     * Adjust sensitivity of b_frame_strategy 1.
2297 2293
      * - encoding: Set by user.
2298
-     * - decoding: Set by libavcodec.
2294
+     * - decoding: unused
2299 2295
      */
2300
-     int profile;
2301
-#define FF_PROFILE_UNKNOWN -99
2302
-#define FF_PROFILE_RESERVED -100
2296
+    int b_sensitivity;
2303 2297
 
2304
-#define FF_PROFILE_AAC_MAIN 0
2305
-#define FF_PROFILE_AAC_LOW  1
2306
-#define FF_PROFILE_AAC_SSR  2
2307
-#define FF_PROFILE_AAC_LTP  3
2298
+    /**
2299
+     * Chromaticity coordinates of the source primaries.
2300
+     * - encoding: Set by user
2301
+     * - decoding: Set by libavcodec
2302
+     */
2303
+    enum AVColorPrimaries color_primaries;
2308 2304
 
2309
-#define FF_PROFILE_DTS         20
2310
-#define FF_PROFILE_DTS_ES      30
2311
-#define FF_PROFILE_DTS_96_24   40
2312
-#define FF_PROFILE_DTS_HD_HRA  50
2313
-#define FF_PROFILE_DTS_HD_MA   60
2305
+    /**
2306
+     * Color Transfer Characteristic.
2307
+     * - encoding: Set by user
2308
+     * - decoding: Set by libavcodec
2309
+     */
2310
+    enum AVColorTransferCharacteristic color_trc;
2314 2311
 
2315
-#define FF_PROFILE_MPEG2_422    0
2316
-#define FF_PROFILE_MPEG2_HIGH   1
2317
-#define FF_PROFILE_MPEG2_SS     2
2318
-#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
2319
-#define FF_PROFILE_MPEG2_MAIN   4
2320
-#define FF_PROFILE_MPEG2_SIMPLE 5
2312
+    /**
2313
+     * YUV colorspace type.
2314
+     * - encoding: Set by user
2315
+     * - decoding: Set by libavcodec
2316
+     */
2317
+    enum AVColorSpace colorspace;
2321 2318
 
2322
-#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
2323
-#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
2319
+    /**
2320
+     * MPEG vs JPEG YUV range.
2321
+     * - encoding: Set by user
2322
+     * - decoding: Set by libavcodec
2323
+     */
2324
+    enum AVColorRange color_range;
2324 2325
 
2325
-#define FF_PROFILE_H264_BASELINE             66
2326
-#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2327
-#define FF_PROFILE_H264_MAIN                 77
2328
-#define FF_PROFILE_H264_EXTENDED             88
2329
-#define FF_PROFILE_H264_HIGH                 100
2330
-#define FF_PROFILE_H264_HIGH_10              110
2331
-#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
2332
-#define FF_PROFILE_H264_HIGH_422             122
2333
-#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
2334
-#define FF_PROFILE_H264_HIGH_444             144
2335
-#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
2336
-#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
2337
-#define FF_PROFILE_H264_CAVLC_444            44
2326
+    /**
2327
+     * This defines the location of chroma samples.
2328
+     * - encoding: Set by user
2329
+     * - decoding: Set by libavcodec
2330
+     */
2331
+    enum AVChromaLocation chroma_sample_location;
2338 2332
 
2339
-#define FF_PROFILE_VC1_SIMPLE   0
2340
-#define FF_PROFILE_VC1_MAIN     1
2341
-#define FF_PROFILE_VC1_COMPLEX  2
2342
-#define FF_PROFILE_VC1_ADVANCED 3
2333
+    /**
2334
+     * Number of slices.
2335
+     * Indicates number of picture subdivisions. Used for parallelized
2336
+     * decoding.
2337
+     * - encoding: Set by user
2338
+     * - decoding: unused
2339
+     */
2340
+    int slices;
2343 2341
 
2344
-#define FF_PROFILE_MPEG4_SIMPLE                     0
2345
-#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
2346
-#define FF_PROFILE_MPEG4_CORE                       2
2347
-#define FF_PROFILE_MPEG4_MAIN                       3
2348
-#define FF_PROFILE_MPEG4_N_BIT                      4
2349
-#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
2350
-#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
2351
-#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
2352
-#define FF_PROFILE_MPEG4_HYBRID                     8
2353
-#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
2354
-#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
2355
-#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
2356
-#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
2357
-#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2358
-#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
2359
-#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
2342
+    /** Field order
2343
+     * - encoding: set by libavcodec
2344
+     * - decoding: Set by libavcodec
2345
+     */
2346
+    enum AVFieldOrder field_order;
2347
+
2348
+    /* audio only */
2349
+    int sample_rate; ///< samples per second
2350
+    int channels;    ///< number of audio channels
2360 2351
 
2361 2352
     /**
2362
-     * level
2353
+     * audio sample format
2363 2354
      * - encoding: Set by user.
2364 2355
      * - decoding: Set by libavcodec.
2365 2356
      */
2366
-     int level;
2367
-#define FF_LEVEL_UNKNOWN -99
2357
+    enum AVSampleFormat sample_fmt;  ///< sample format
2368 2358
 
2359
+    /* The following data should not be initialized. */
2369 2360
     /**
2370
-     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2361
+     * Samples per packet, initialized when calling 'init'.
2362
+     */
2363
+    int frame_size;
2364
+    int frame_number;   ///< audio or video frame number
2365
+
2366
+    /**
2367
+     * number of bytes per packet if constant and known or 0
2368
+     * Used by some WAV based audio codecs.
2369
+     */
2370
+    int block_align;
2371
+
2372
+    /**
2373
+     * Audio cutoff bandwidth (0 means "automatic")
2374
+     * - encoding: Set by user.
2375
+     * - decoding: unused
2376
+     */
2377
+    int cutoff;
2378
+
2379
+#if FF_API_REQUEST_CHANNELS
2380
+    /**
2381
+     * Decoder should decode to this many channels if it can (0 for default)
2371 2382
      * - encoding: unused
2372 2383
      * - decoding: Set by user.
2384
+     * @deprecated Deprecated in favor of request_channel_layout.
2373 2385
      */
2374
-     int lowres;
2386
+    int request_channels;
2387
+#endif
2375 2388
 
2376 2389
     /**
2377
-     * Bitstream width / height, may be different from width/height if lowres enabled.
2390
+     * Audio channel layout.
2391
+     * - encoding: set by user.
2392
+     * - decoding: set by user, may be overwritten by libavcodec.
2393
+     */
2394
+    uint64_t channel_layout;
2395
+
2396
+    /**
2397
+     * Request decoder to use this channel layout if it can (0 for default)
2378 2398
      * - encoding: unused
2379
-     * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
2399
+     * - decoding: Set by user.
2380 2400
      */
2381
-    int coded_width, coded_height;
2401
+    uint64_t request_channel_layout;
2382 2402
 
2383 2403
     /**
2384
-     * frame skip threshold
2404
+     * Type of service that the audio stream conveys.
2385 2405
      * - encoding: Set by user.
2386
-     * - decoding: unused
2406
+     * - decoding: Set by libavcodec.
2387 2407
      */
2388
-    int frame_skip_threshold;
2408
+    enum AVAudioServiceType audio_service_type;
2389 2409
 
2390 2410
     /**
2391
-     * frame skip factor
2411
+     * desired sample format
2412
+     * - encoding: Not used.
2413
+     * - decoding: Set by user.
2414
+     * Decoder will decode to this format if it can.
2415
+     */
2416
+    enum AVSampleFormat request_sample_fmt;
2417
+
2418
+    /**
2419
+     * Called at the beginning of each frame to get a buffer for it.
2420
+     *
2421
+     * The function will set AVFrame.data[], AVFrame.linesize[].
2422
+     * AVFrame.extended_data[] must also be set, but it should be the same as
2423
+     * AVFrame.data[] except for planar audio with more channels than can fit
2424
+     * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
2425
+     * many data pointers as it can hold.
2426
+     *
2427
+     * if CODEC_CAP_DR1 is not set then get_buffer() must call
2428
+     * avcodec_default_get_buffer() instead of providing buffers allocated by
2429
+     * some other means.
2430
+     *
2431
+     * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
2432
+     * need it. avcodec_default_get_buffer() aligns the output buffer properly,
2433
+     * but if get_buffer() is overridden then alignment considerations should
2434
+     * be taken into account.
2435
+     *
2436
+     * @see avcodec_default_get_buffer()
2437
+     *
2438
+     * Video:
2439
+     *
2440
+     * If pic.reference is set then the frame will be read later by libavcodec.
2441
+     * avcodec_align_dimensions2() should be used to find the required width and
2442
+     * height, as they normally need to be rounded up to the next multiple of 16.
2443
+     *
2444
+     * If frame multithreading is used and thread_safe_callbacks is set,
2445
+     * it may be called from a different thread, but not from more than one at
2446
+     * once. Does not need to be reentrant.
2447
+     *
2448
+     * @see release_buffer(), reget_buffer()
2449
+     * @see avcodec_align_dimensions2()
2450
+     *
2451
+     * Audio:
2452
+     *
2453
+     * Decoders request a buffer of a particular size by setting
2454
+     * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
2455
+     * however, utilize only part of the buffer by setting AVFrame.nb_samples
2456
+     * to a smaller value in the output frame.
2457
+     *
2458
+     * Decoders cannot use the buffer after returning from
2459
+     * avcodec_decode_audio4(), so they will not call release_buffer(), as it
2460
+     * is assumed to be released immediately upon return.
2461
+     *
2462
+     * As a convenience, av_samples_get_buffer_size() and
2463
+     * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
2464
+     * functions to find the required data size and to fill data pointers and
2465
+     * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2466
+     * since all planes must be the same size.
2467
+     *
2468
+     * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2469
+     *
2470
+     * - encoding: unused
2471
+     * - decoding: Set by libavcodec, user can override.
2472
+     */
2473
+    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
2474
+
2475
+    /**
2476
+     * Called to release buffers which were allocated with get_buffer.
2477
+     * A released buffer can be reused in get_buffer().
2478
+     * pic.data[*] must be set to NULL.
2479
+     * May be called from a different thread if frame multithreading is used,
2480
+     * but not by more than one thread at once, so does not need to be reentrant.
2481
+     * - encoding: unused
2482
+     * - decoding: Set by libavcodec, user can override.
2483
+     */
2484
+    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
2485
+
2486
+    /**
2487
+     * Called at the beginning of a frame to get cr buffer for it.
2488
+     * Buffer type (size, hints) must be the same. libavcodec won't check it.
2489
+     * libavcodec will pass previous buffer in pic, function should return
2490
+     * same buffer or new buffer with old frame "painted" into it.
2491
+     * If pic.data[0] == NULL must behave like get_buffer().
2492
+     * if CODEC_CAP_DR1 is not set then reget_buffer() must call
2493
+     * avcodec_default_reget_buffer() instead of providing buffers allocated by
2494
+     * some other means.
2495
+     * - encoding: unused
2496
+     * - decoding: Set by libavcodec, user can override.
2497
+     */
2498
+    int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
2499
+
2500
+
2501
+    /* - encoding parameters */
2502
+    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
2503
+    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
2504
+
2505
+    /**
2506
+     * minimum quantizer
2392 2507
      * - encoding: Set by user.
2393 2508
      * - decoding: unused
2394 2509
      */
2395
-    int frame_skip_factor;
2510
+    int qmin;
2396 2511
 
2397 2512
     /**
2398
-     * frame skip exponent
2513
+     * maximum quantizer
2399 2514
      * - encoding: Set by user.
2400 2515
      * - decoding: unused
2401 2516
      */
2402
-    int frame_skip_exp;
2517
+    int qmax;
2403 2518
 
2404 2519
     /**
2405
-     * frame skip comparison function
2520
+     * maximum quantizer difference between frames
2406 2521
      * - encoding: Set by user.
2407 2522
      * - decoding: unused
2408 2523
      */
2409
-    int frame_skip_cmp;
2524
+    int max_qdiff;
2410 2525
 
2411 2526
     /**
2412
-     * Border processing masking, raises the quantizer for mbs on the borders
2413
-     * of the picture.
2527
+     * ratecontrol qmin qmax limiting method
2528
+     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
2414 2529
      * - encoding: Set by user.
2415 2530
      * - decoding: unused
2416 2531
      */
2417
-    float border_masking;
2532
+    float rc_qsquish;
2533
+
2534
+    float rc_qmod_amp;
2535
+    int rc_qmod_freq;
2418 2536
 
2419 2537
     /**
2420
-     * minimum MB lagrange multipler
2538
+     * decoder bitstream buffer size
2421 2539
      * - encoding: Set by user.
2422 2540
      * - decoding: unused
2423 2541
      */
2424
-    int mb_lmin;
2542
+    int rc_buffer_size;
2425 2543
 
2426 2544
     /**
2427
-     * maximum MB lagrange multipler
2428
-     * - encoding: Set by user.
2545
+     * ratecontrol override, see RcOverride
2546
+     * - encoding: Allocated/set/freed by user.
2429 2547
      * - decoding: unused
2430 2548
      */
2431
-    int mb_lmax;
2549
+    int rc_override_count;
2550
+    RcOverride *rc_override;
2432 2551
 
2433 2552
     /**
2434
-     *
2553
+     * rate control equation
2554
+     * - encoding: Set by user
2555
+     * - decoding: unused
2556
+     */
2557
+    const char *rc_eq;
2558
+
2559
+    /**
2560
+     * maximum bitrate
2435 2561
      * - encoding: Set by user.
2436 2562
      * - decoding: unused
2437 2563
      */
2438
-    int me_penalty_compensation;
2564
+    int rc_max_rate;
2439 2565
 
2440 2566
     /**
2441
-     *
2442
-     * - encoding: unused
2443
-     * - decoding: Set by user.
2567
+     * minimum bitrate
2568
+     * - encoding: Set by user.
2569
+     * - decoding: unused
2444 2570
      */
2445
-    enum AVDiscard skip_loop_filter;
2571
+    int rc_min_rate;
2572
+
2573
+    float rc_buffer_aggressivity;
2446 2574
 
2447 2575
     /**
2448
-     *
2449
-     * - encoding: unused
2450
-     * - decoding: Set by user.
2576
+     * initial complexity for pass1 ratecontrol
2577
+     * - encoding: Set by user.
2578
+     * - decoding: unused
2451 2579
      */
2452
-    enum AVDiscard skip_idct;
2580
+    float rc_initial_cplx;
2453 2581
 
2454 2582
     /**
2455
-     *
2456
-     * - encoding: unused
2457
-     * - decoding: Set by user.
2583
+     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2584
+     * - encoding: Set by user.
2585
+     * - decoding: unused.
2458 2586
      */
2459
-    enum AVDiscard skip_frame;
2587
+    float rc_max_available_vbv_use;
2460 2588
 
2461 2589
     /**
2462
-     *
2590
+     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2463 2591
      * - encoding: Set by user.
2464
-     * - decoding: unused
2592
+     * - decoding: unused.
2465 2593
      */
2466
-    int bidir_refine;
2594
+    float rc_min_vbv_overflow_use;
2467 2595
 
2468 2596
     /**
2469
-     *
2597
+     * Number of bits which should be loaded into the rc buffer before decoding starts.
2470 2598
      * - encoding: Set by user.
2471 2599
      * - decoding: unused
2472 2600
      */
2473
-    int brd_scale;
2601
+    int rc_initial_buffer_occupancy;
2474 2602
 
2603
+#define FF_CODER_TYPE_VLC       0
2604
+#define FF_CODER_TYPE_AC        1
2605
+#define FF_CODER_TYPE_RAW       2
2606
+#define FF_CODER_TYPE_RLE       3
2607
+#define FF_CODER_TYPE_DEFLATE   4
2475 2608
     /**
2476
-     * minimum GOP size
2609
+     * coder type
2477 2610
      * - encoding: Set by user.
2478 2611
      * - decoding: unused
2479 2612
      */
2480
-    int keyint_min;
2613
+    int coder_type;
2481 2614
 
2482 2615
     /**
2483
-     * number of reference frames
2616
+     * context model
2484 2617
      * - encoding: Set by user.
2485
-     * - decoding: Set by lavc.
2618
+     * - decoding: unused
2486 2619
      */
2487
-    int refs;
2620
+    int context_model;
2488 2621
 
2489 2622
     /**
2490
-     * chroma qp offset from luma
2623
+     * minimum Lagrange multipler
2491 2624
      * - encoding: Set by user.
2492 2625
      * - decoding: unused
2493 2626
      */
2494
-    int chromaoffset;
2627
+    int lmin;
2495 2628
 
2496 2629
     /**
2497
-     * trellis RD quantization
2630
+     * maximum Lagrange multipler
2498 2631
      * - encoding: Set by user.
2499 2632
      * - decoding: unused
2500 2633
      */
2501
-    int trellis;
2634
+    int lmax;
2502 2635
 
2503 2636
     /**
2504
-     * Audio cutoff bandwidth (0 means "automatic")
2637
+     * frame skip threshold
2505 2638
      * - encoding: Set by user.
2506 2639
      * - decoding: unused
2507 2640
      */
2508
-    int cutoff;
2641
+    int frame_skip_threshold;
2509 2642
 
2510 2643
     /**
2511
-     * Multiplied by qscale for each frame and added to scene_change_score.
2644
+     * frame skip factor
2512 2645
      * - encoding: Set by user.
2513 2646
      * - decoding: unused
2514 2647
      */
2515
-    int scenechange_factor;
2648
+    int frame_skip_factor;
2516 2649
 
2517 2650
     /**
2518
-     *
2519
-     * Note: Value depends upon the compare function used for fullpel ME.
2651
+     * frame skip exponent
2520 2652
      * - encoding: Set by user.
2521 2653
      * - decoding: unused
2522 2654
      */
2523
-    int mv0_threshold;
2655
+    int frame_skip_exp;
2524 2656
 
2525 2657
     /**
2526
-     * Adjust sensitivity of b_frame_strategy 1.
2658
+     * frame skip comparison function
2527 2659
      * - encoding: Set by user.
2528 2660
      * - decoding: unused
2529 2661
      */
2530
-    int b_sensitivity;
2662
+    int frame_skip_cmp;
2531 2663
 
2532 2664
     /**
2665
+     * trellis RD quantization
2533 2666
      * - encoding: Set by user.
2534 2667
      * - decoding: unused
2535 2668
      */
2536
-    int compression_level;
2537
-#define FF_COMPRESSION_DEFAULT -1
2669
+    int trellis;
2538 2670
 
2539 2671
     /**
2540 2672
      * - encoding: Set by user.
... ...
@@ -2555,59 +2328,162 @@ typedef struct AVCodecContext {
2555 2555
      */
2556 2556
     int64_t timecode_frame_start;
2557 2557
 
2558
-#if FF_API_REQUEST_CHANNELS
2558
+    /* The RTP callback: This function is called    */
2559
+    /* every time the encoder has a packet to send. */
2560
+    /* It depends on the encoder if the data starts */
2561
+    /* with a Start Code (it should). H.263 does.   */
2562
+    /* mb_nb contains the number of macroblocks     */
2563
+    /* encoded in the RTP payload.                  */
2564
+    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
2565
+
2566
+    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
2567
+                            /* do its best to deliver a chunk with size     */
2568
+                            /* below rtp_payload_size, the chunk will start */
2569
+                            /* with a start code on some codecs like H.263. */
2570
+                            /* This doesn't take account of any particular  */
2571
+                            /* headers inside the transmitted RTP payload.  */
2572
+
2573
+    /* statistics, used for 2-pass encoding */
2574
+    int mv_bits;
2575
+    int header_bits;
2576
+    int i_tex_bits;
2577
+    int p_tex_bits;
2578
+    int i_count;
2579
+    int p_count;
2580
+    int skip_count;
2581
+    int misc_bits;
2582
+
2559 2583
     /**
2560
-     * Decoder should decode to this many channels if it can (0 for default)
2561
-     * - encoding: unused
2562
-     * - decoding: Set by user.
2563
-     * @deprecated Deprecated in favor of request_channel_layout.
2584
+     * number of bits used for the previously encoded frame
2585
+     * - encoding: Set by libavcodec.
2586
+     * - decoding: unused
2564 2587
      */
2565
-    int request_channels;
2566
-#endif
2588
+    int frame_bits;
2567 2589
 
2568 2590
     /**
2569
-     * opaque 64bit number (generally a PTS) that will be reordered and
2570
-     * output in AVFrame.reordered_opaque
2571
-     * @deprecated in favor of pkt_pts
2572
-     * - encoding: unused
2573
-     * - decoding: Set by user.
2591
+     * pass1 encoding statistics output buffer
2592
+     * - encoding: Set by libavcodec.
2593
+     * - decoding: unused
2574 2594
      */
2575
-    int64_t reordered_opaque;
2595
+    char *stats_out;
2576 2596
 
2577 2597
     /**
2578
-     * Bits per sample/pixel of internal libavcodec pixel/sample format.
2579
-     * - encoding: set by user.
2580
-     * - decoding: set by libavcodec.
2598
+     * pass2 encoding statistics input buffer
2599
+     * Concatenated stuff from stats_out of pass1 should be placed here.
2600
+     * - encoding: Allocated/set/freed by user.
2601
+     * - decoding: unused
2581 2602
      */
2582
-    int bits_per_raw_sample;
2603
+    char *stats_in;
2583 2604
 
2584 2605
     /**
2585
-     * Audio channel layout.
2586
-     * - encoding: set by user.
2587
-     * - decoding: set by user, may be overwritten by libavcodec.
2606
+     * Work around bugs in encoders which sometimes cannot be detected automatically.
2607
+     * - encoding: Set by user
2608
+     * - decoding: Set by user
2588 2609
      */
2589
-    uint64_t channel_layout;
2610
+    int workaround_bugs;
2611
+#define FF_BUG_AUTODETECT       1  ///< autodetection
2612
+#define FF_BUG_OLD_MSMPEG4      2
2613
+#define FF_BUG_XVID_ILACE       4
2614
+#define FF_BUG_UMP4             8
2615
+#define FF_BUG_NO_PADDING       16
2616
+#define FF_BUG_AMV              32
2617
+#define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
2618
+#define FF_BUG_QPEL_CHROMA      64
2619
+#define FF_BUG_STD_QPEL         128
2620
+#define FF_BUG_QPEL_CHROMA2     256
2621
+#define FF_BUG_DIRECT_BLOCKSIZE 512
2622
+#define FF_BUG_EDGE             1024
2623
+#define FF_BUG_HPEL_CHROMA      2048
2624
+#define FF_BUG_DC_CLIP          4096
2625
+#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
2626
+#define FF_BUG_TRUNCATED       16384
2590 2627
 
2591 2628
     /**
2592
-     * Request decoder to use this channel layout if it can (0 for default)
2629
+     * strictly follow the standard (MPEG4, ...).
2630
+     * - encoding: Set by user.
2631
+     * - decoding: Set by user.
2632
+     * Setting this to STRICT or higher means the encoder and decoder will
2633
+     * generally do stupid things, whereas setting it to unofficial or lower
2634
+     * will mean the encoder might produce output that is not supported by all
2635
+     * spec-compliant decoders. Decoders don't differentiate between normal,
2636
+     * unofficial and experimental (that is, they always try to decode things
2637
+     * when they can) unless they are explicitly asked to behave stupidly
2638
+     * (=strictly conform to the specs)
2639
+     */
2640
+    int strict_std_compliance;
2641
+#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
2642
+#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
2643
+#define FF_COMPLIANCE_NORMAL        0
2644
+#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
2645
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
2646
+
2647
+    /**
2648
+     * error concealment flags
2593 2649
      * - encoding: unused
2594 2650
      * - decoding: Set by user.
2595 2651
      */
2596
-    uint64_t request_channel_layout;
2652
+    int error_concealment;
2653
+#define FF_EC_GUESS_MVS   1
2654
+#define FF_EC_DEBLOCK     2
2597 2655
 
2598 2656
     /**
2599
-     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2657
+     * debug
2600 2658
      * - encoding: Set by user.
2601
-     * - decoding: unused.
2659
+     * - decoding: Set by user.
2602 2660
      */
2603
-    float rc_max_available_vbv_use;
2661
+    int debug;
2662
+#define FF_DEBUG_PICT_INFO   1
2663
+#define FF_DEBUG_RC          2
2664
+#define FF_DEBUG_BITSTREAM   4
2665
+#define FF_DEBUG_MB_TYPE     8
2666
+#define FF_DEBUG_QP          16
2667
+#define FF_DEBUG_MV          32
2668
+#define FF_DEBUG_DCT_COEFF   0x00000040
2669
+#define FF_DEBUG_SKIP        0x00000080
2670
+#define FF_DEBUG_STARTCODE   0x00000100
2671
+#define FF_DEBUG_PTS         0x00000200
2672
+#define FF_DEBUG_ER          0x00000400
2673
+#define FF_DEBUG_MMCO        0x00000800
2674
+#define FF_DEBUG_BUGS        0x00001000
2675
+#define FF_DEBUG_VIS_QP      0x00002000
2676
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
2677
+#define FF_DEBUG_BUFFERS     0x00008000
2678
+#define FF_DEBUG_THREADS     0x00010000
2604 2679
 
2605 2680
     /**
2606
-     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2681
+     * debug
2607 2682
      * - encoding: Set by user.
2608
-     * - decoding: unused.
2683
+     * - decoding: Set by user.
2609 2684
      */
2610
-    float rc_min_vbv_overflow_use;
2685
+    int debug_mv;
2686
+#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
2687
+#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
2688
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
2689
+
2690
+    /**
2691
+     * Error recognition; may misdetect some more or less valid parts as errors.
2692
+     * - encoding: unused
2693
+     * - decoding: Set by user.
2694
+     */
2695
+    int err_recognition;
2696
+#define AV_EF_CRCCHECK  (1<<0)
2697
+#define AV_EF_BITSTREAM (1<<1)
2698
+#define AV_EF_BUFFER    (1<<2)
2699
+#define AV_EF_EXPLODE   (1<<3)
2700
+
2701
+#define AV_EF_CAREFUL    (1<<16)
2702
+#define AV_EF_COMPLIANT  (1<<17)
2703
+#define AV_EF_AGGRESSIVE (1<<18)
2704
+
2705
+
2706
+    /**
2707
+     * opaque 64bit number (generally a PTS) that will be reordered and
2708
+     * output in AVFrame.reordered_opaque
2709
+     * @deprecated in favor of pkt_pts
2710
+     * - encoding: unused
2711
+     * - decoding: Set by user.
2712
+     */
2713
+    int64_t reordered_opaque;
2611 2714
 
2612 2715
     /**
2613 2716
      * Hardware accelerator in use
... ...
@@ -2617,15 +2493,6 @@ typedef struct AVCodecContext {
2617 2617
     struct AVHWAccel *hwaccel;
2618 2618
 
2619 2619
     /**
2620
-     * For some codecs, the time base is closer to the field rate than the frame rate.
2621
-     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2622
-     * if no telecine is used ...
2623
-     *
2624
-     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2625
-     */
2626
-    int ticks_per_frame;
2627
-
2628
-    /**
2629 2620
      * Hardware accelerator context.
2630 2621
      * For some hardware accelerators, a global context needs to be
2631 2622
      * provided by the user. In that case, this holds display-dependent
... ...
@@ -2638,90 +2505,101 @@ typedef struct AVCodecContext {
2638 2638
     void *hwaccel_context;
2639 2639
 
2640 2640
     /**
2641
-     * Chromaticity coordinates of the source primaries.
2642
-     * - encoding: Set by user
2643
-     * - decoding: Set by libavcodec
2641
+     * error
2642
+     * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
2643
+     * - decoding: unused
2644 2644
      */
2645
-    enum AVColorPrimaries color_primaries;
2645
+    uint64_t error[AV_NUM_DATA_POINTERS];
2646 2646
 
2647 2647
     /**
2648
-     * Color Transfer Characteristic.
2649
-     * - encoding: Set by user
2650
-     * - decoding: Set by libavcodec
2648
+     * DCT algorithm, see FF_DCT_* below
2649
+     * - encoding: Set by user.
2650
+     * - decoding: unused
2651 2651
      */
2652
-    enum AVColorTransferCharacteristic color_trc;
2652
+    int dct_algo;
2653
+#define FF_DCT_AUTO    0
2654
+#define FF_DCT_FASTINT 1
2655
+#define FF_DCT_INT     2
2656
+#define FF_DCT_MMX     3
2657
+#define FF_DCT_ALTIVEC 5
2658
+#define FF_DCT_FAAN    6
2653 2659
 
2654 2660
     /**
2655
-     * YUV colorspace type.
2656
-     * - encoding: Set by user
2657
-     * - decoding: Set by libavcodec
2661
+     * IDCT algorithm, see FF_IDCT_* below.
2662
+     * - encoding: Set by user.
2663
+     * - decoding: Set by user.
2658 2664
      */
2659
-    enum AVColorSpace colorspace;
2665
+    int idct_algo;
2666
+#define FF_IDCT_AUTO          0
2667
+#define FF_IDCT_INT           1
2668
+#define FF_IDCT_SIMPLE        2
2669
+#define FF_IDCT_SIMPLEMMX     3
2670
+#define FF_IDCT_LIBMPEG2MMX   4
2671
+#define FF_IDCT_MMI           5
2672
+#define FF_IDCT_ARM           7
2673
+#define FF_IDCT_ALTIVEC       8
2674
+#define FF_IDCT_SH4           9
2675
+#define FF_IDCT_SIMPLEARM     10
2676
+#define FF_IDCT_H264          11
2677
+#define FF_IDCT_VP3           12
2678
+#define FF_IDCT_IPP           13
2679
+#define FF_IDCT_XVIDMMX       14
2680
+#define FF_IDCT_CAVS          15
2681
+#define FF_IDCT_SIMPLEARMV5TE 16
2682
+#define FF_IDCT_SIMPLEARMV6   17
2683
+#define FF_IDCT_SIMPLEVIS     18
2684
+#define FF_IDCT_WMV2          19
2685
+#define FF_IDCT_FAAN          20
2686
+#define FF_IDCT_EA            21
2687
+#define FF_IDCT_SIMPLENEON    22
2688
+#define FF_IDCT_SIMPLEALPHA   23
2689
+#define FF_IDCT_BINK          24
2660 2690
 
2661 2691
     /**
2662
-     * MPEG vs JPEG YUV range.
2663
-     * - encoding: Set by user
2664
-     * - decoding: Set by libavcodec
2692
+     * dsp_mask could be add used to disable unwanted CPU features
2693
+     * CPU features (i.e. MMX, SSE. ...)
2694
+     *
2695
+     * With the FORCE flag you may instead enable given CPU features.
2696
+     * (Dangerous: Usable in case of misdetection, improper usage however will
2697
+     * result into program crash.)
2665 2698
      */
2666
-    enum AVColorRange color_range;
2699
+    unsigned dsp_mask;
2667 2700
 
2668 2701
     /**
2669
-     * This defines the location of chroma samples.
2670
-     * - encoding: Set by user
2671
-     * - decoding: Set by libavcodec
2702
+     * bits per sample/pixel from the demuxer (needed for huffyuv).
2703
+     * - encoding: Set by libavcodec.
2704
+     * - decoding: Set by user.
2672 2705
      */
2673
-    enum AVChromaLocation chroma_sample_location;
2706
+     int bits_per_coded_sample;
2674 2707
 
2675 2708
     /**
2676
-     * The codec may call this to execute several independent things.
2677
-     * It will return only after finishing all tasks.
2678
-     * The user may replace this with some multithreaded implementation,
2679
-     * the default implementation will execute the parts serially.
2680
-     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
2681
-     * @param c context passed also to func
2682
-     * @param count the number of things to execute
2683
-     * @param arg2 argument passed unchanged to func
2684
-     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
2685
-     * @param func function that will be called count times, with jobnr from 0 to count-1.
2686
-     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
2687
-     *             two instances of func executing at the same time will have the same threadnr.
2688
-     * @return always 0 currently, but code should handle a future improvement where when any call to func
2689
-     *         returns < 0 no further calls to func may be done and < 0 is returned.
2690
-     * - encoding: Set by libavcodec, user can override.
2691
-     * - decoding: Set by libavcodec, user can override.
2709
+     * Bits per sample/pixel of internal libavcodec pixel/sample format.
2710
+     * - encoding: set by user.
2711
+     * - decoding: set by libavcodec.
2692 2712
      */
2693
-    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
2694
-
2695
-    int log_level_offset;
2713
+    int bits_per_raw_sample;
2696 2714
 
2697 2715
     /**
2698
-     * Number of slices.
2699
-     * Indicates number of picture subdivisions. Used for parallelized
2700
-     * decoding.
2701
-     * - encoding: Set by user
2702
-     * - decoding: unused
2716
+     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2717
+     * - encoding: unused
2718
+     * - decoding: Set by user.
2703 2719
      */
2704
-    int slices;
2720
+     int lowres;
2705 2721
 
2706 2722
     /**
2707
-     * Header containing style information for text subtitles.
2708
-     * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
2709
-     * [Script Info] and [V4+ Styles] section, plus the [Events] line and
2710
-     * the Format line following. It shouldn't include any Dialogue line.
2711
-     * - encoding: Set/allocated/freed by user (before avcodec_open2())
2712
-     * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
2723
+     * the picture in the bitstream
2724
+     * - encoding: Set by libavcodec.
2725
+     * - decoding: Set by libavcodec.
2713 2726
      */
2714
-    uint8_t *subtitle_header;
2715
-    int subtitle_header_size;
2727
+    AVFrame *coded_frame;
2716 2728
 
2717 2729
     /**
2718
-     * Current packet as passed into the decoder, to avoid having
2719
-     * to pass the packet into every function. Currently only valid
2720
-     * inside lavc and get/release_buffer callbacks.
2721
-     * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
2722
-     * - encoding: unused
2730
+     * thread count
2731
+     * is used to decide how many independent tasks should be passed to execute()
2732
+     * - encoding: Set by user.
2733
+     * - decoding: Set by user.
2723 2734
      */
2724
-    AVPacket *pkt;
2735
+    int thread_count;
2725 2736
 
2726 2737
     /**
2727 2738
      * Which multithreading methods to use.
... ...
@@ -2753,56 +2631,180 @@ typedef struct AVCodecContext {
2753 2753
     int thread_safe_callbacks;
2754 2754
 
2755 2755
     /**
2756
-     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
2757
-     * Used for compliant TS muxing.
2758
-     * - encoding: Set by libavcodec.
2759
-     * - decoding: unused.
2756
+     * The codec may call this to execute several independent things.
2757
+     * It will return only after finishing all tasks.
2758
+     * The user may replace this with some multithreaded implementation,
2759
+     * the default implementation will execute the parts serially.
2760
+     * @param count the number of things to execute
2761
+     * - encoding: Set by libavcodec, user can override.
2762
+     * - decoding: Set by libavcodec, user can override.
2760 2763
      */
2761
-    uint64_t vbv_delay;
2764
+    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
2762 2765
 
2763 2766
     /**
2764
-     * Type of service that the audio stream conveys.
2767
+     * The codec may call this to execute several independent things.
2768
+     * It will return only after finishing all tasks.
2769
+     * The user may replace this with some multithreaded implementation,
2770
+     * the default implementation will execute the parts serially.
2771
+     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
2772
+     * @param c context passed also to func
2773
+     * @param count the number of things to execute
2774
+     * @param arg2 argument passed unchanged to func
2775
+     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
2776
+     * @param func function that will be called count times, with jobnr from 0 to count-1.
2777
+     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
2778
+     *             two instances of func executing at the same time will have the same threadnr.
2779
+     * @return always 0 currently, but code should handle a future improvement where when any call to func
2780
+     *         returns < 0 no further calls to func may be done and < 0 is returned.
2781
+     * - encoding: Set by libavcodec, user can override.
2782
+     * - decoding: Set by libavcodec, user can override.
2783
+     */
2784
+    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
2785
+
2786
+    /**
2787
+     * thread opaque
2788
+     * Can be used by execute() to store some per AVCodecContext stuff.
2789
+     * - encoding: set by execute()
2790
+     * - decoding: set by execute()
2791
+     */
2792
+    void *thread_opaque;
2793
+
2794
+    /**
2795
+     * noise vs. sse weight for the nsse comparsion function
2796
+     * - encoding: Set by user.
2797
+     * - decoding: unused
2798
+     */
2799
+     int nsse_weight;
2800
+
2801
+    /**
2802
+     * profile
2765 2803
      * - encoding: Set by user.
2766 2804
      * - decoding: Set by libavcodec.
2767 2805
      */
2768
-    enum AVAudioServiceType audio_service_type;
2806
+     int profile;
2807
+#define FF_PROFILE_UNKNOWN -99
2808
+#define FF_PROFILE_RESERVED -100
2809
+
2810
+#define FF_PROFILE_AAC_MAIN 0
2811
+#define FF_PROFILE_AAC_LOW  1
2812
+#define FF_PROFILE_AAC_SSR  2
2813
+#define FF_PROFILE_AAC_LTP  3
2814
+
2815
+#define FF_PROFILE_DTS         20
2816
+#define FF_PROFILE_DTS_ES      30
2817
+#define FF_PROFILE_DTS_96_24   40
2818
+#define FF_PROFILE_DTS_HD_HRA  50
2819
+#define FF_PROFILE_DTS_HD_MA   60
2820
+
2821
+#define FF_PROFILE_MPEG2_422    0
2822
+#define FF_PROFILE_MPEG2_HIGH   1
2823
+#define FF_PROFILE_MPEG2_SS     2
2824
+#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
2825
+#define FF_PROFILE_MPEG2_MAIN   4
2826
+#define FF_PROFILE_MPEG2_SIMPLE 5
2827
+
2828
+#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
2829
+#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
2830
+
2831
+#define FF_PROFILE_H264_BASELINE             66
2832
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2833
+#define FF_PROFILE_H264_MAIN                 77
2834
+#define FF_PROFILE_H264_EXTENDED             88
2835
+#define FF_PROFILE_H264_HIGH                 100
2836
+#define FF_PROFILE_H264_HIGH_10              110
2837
+#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
2838
+#define FF_PROFILE_H264_HIGH_422             122
2839
+#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
2840
+#define FF_PROFILE_H264_HIGH_444             144
2841
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
2842
+#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
2843
+#define FF_PROFILE_H264_CAVLC_444            44
2844
+
2845
+#define FF_PROFILE_VC1_SIMPLE   0
2846
+#define FF_PROFILE_VC1_MAIN     1
2847
+#define FF_PROFILE_VC1_COMPLEX  2
2848
+#define FF_PROFILE_VC1_ADVANCED 3
2849
+
2850
+#define FF_PROFILE_MPEG4_SIMPLE                     0
2851
+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
2852
+#define FF_PROFILE_MPEG4_CORE                       2
2853
+#define FF_PROFILE_MPEG4_MAIN                       3
2854
+#define FF_PROFILE_MPEG4_N_BIT                      4
2855
+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
2856
+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
2857
+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
2858
+#define FF_PROFILE_MPEG4_HYBRID                     8
2859
+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
2860
+#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
2861
+#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
2862
+#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
2863
+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2864
+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
2865
+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
2769 2866
 
2770 2867
     /**
2771
-     * desired sample format
2772
-     * - encoding: Not used.
2773
-     * - decoding: Set by user.
2774
-     * Decoder will decode to this format if it can.
2868
+     * level
2869
+     * - encoding: Set by user.
2870
+     * - decoding: Set by libavcodec.
2775 2871
      */
2776
-    enum AVSampleFormat request_sample_fmt;
2872
+     int level;
2873
+#define FF_LEVEL_UNKNOWN -99
2777 2874
 
2778 2875
     /**
2779
-     * Error recognition; may misdetect some more or less valid parts as errors.
2876
+     *
2780 2877
      * - encoding: unused
2781 2878
      * - decoding: Set by user.
2782 2879
      */
2783
-    int err_recognition;
2784
-#define AV_EF_CRCCHECK  (1<<0)
2785
-#define AV_EF_BITSTREAM (1<<1)
2786
-#define AV_EF_BUFFER    (1<<2)
2787
-#define AV_EF_EXPLODE   (1<<3)
2880
+    enum AVDiscard skip_loop_filter;
2788 2881
 
2789
-#define AV_EF_CAREFUL    (1<<16)
2790
-#define AV_EF_COMPLIANT  (1<<17)
2791
-#define AV_EF_AGGRESSIVE (1<<18)
2882
+    /**
2883
+     *
2884
+     * - encoding: unused
2885
+     * - decoding: Set by user.
2886
+     */
2887
+    enum AVDiscard skip_idct;
2792 2888
 
2793 2889
     /**
2794
-     * Private context used for internal data.
2795 2890
      *
2796
-     * Unlike priv_data, this is not codec-specific. It is used in general
2797
-     * libavcodec functions.
2891
+     * - encoding: unused
2892
+     * - decoding: Set by user.
2798 2893
      */
2799
-    struct AVCodecInternal *internal;
2894
+    enum AVDiscard skip_frame;
2800 2895
 
2801
-    /** Field order
2802
-     * - encoding: set by libavcodec
2803
-     * - decoding: Set by libavcodec
2896
+    /**
2897
+     * Header containing style information for text subtitles.
2898
+     * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
2899
+     * [Script Info] and [V4+ Styles] section, plus the [Events] line and
2900
+     * the Format line following. It shouldn't include any Dialogue line.
2901
+     * - encoding: Set/allocated/freed by user (before avcodec_open2())
2902
+     * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
2804 2903
      */
2805
-    enum AVFieldOrder field_order;
2904
+    uint8_t *subtitle_header;
2905
+    int subtitle_header_size;
2906
+
2907
+    /**
2908
+     * Simulates errors in the bitstream to test error concealment.
2909
+     * - encoding: Set by user.
2910
+     * - decoding: unused
2911
+     */
2912
+    int error_rate;
2913
+
2914
+    /**
2915
+     * Current packet as passed into the decoder, to avoid having
2916
+     * to pass the packet into every function. Currently only valid
2917
+     * inside lavc and get/release_buffer callbacks.
2918
+     * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
2919
+     * - encoding: unused
2920
+     */
2921
+    AVPacket *pkt;
2922
+
2923
+    /**
2924
+     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
2925
+     * Used for compliant TS muxing.
2926
+     * - encoding: Set by libavcodec.
2927
+     * - decoding: unused.
2928
+     */
2929
+    uint64_t vbv_delay;
2806 2930
 
2807 2931
     /**
2808 2932
      * Current statistics for PTS correction.
... ...
@@ -2813,7 +2815,6 @@ typedef struct AVCodecContext {
2813 2813
     int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
2814 2814
     int64_t pts_correction_last_pts;       /// PTS of the last frame
2815 2815
     int64_t pts_correction_last_dts;       /// DTS of the last frame
2816
-
2817 2816
 } AVCodecContext;
2818 2817
 
2819 2818
 /**
... ...
@@ -480,7 +480,7 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
480 480
     dst->slice_flags = src->slice_flags;
481 481
     dst->flags2      = src->flags2;
482 482
 
483
-    copy_fields(skip_loop_filter, bidir_refine);
483
+    copy_fields(skip_loop_filter, subtitle_header);
484 484
 
485 485
     dst->frame_number     = src->frame_number;
486 486
     dst->reordered_opaque = src->reordered_opaque;
... ...
@@ -603,7 +603,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
603 603
         return s->get_buffer(s, pic);
604 604
     }
605 605
 
606
-    assert(s->pix_fmt == pic->pix_fmt);
606
+    assert(s->pix_fmt == pic->format);
607 607
 
608 608
     /* If internal buffer type return the same buffer */
609 609
     if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
... ...
@@ -876,7 +876,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
876 876
 %if mmsize < 16
877 877
     add         r0, mmsize
878 878
     add         r5, mmsize
879
-    add         r4, mmsize/8
879
+    add         r4, mmsize/4
880 880
     dec         r6
881 881
     jg .loop
882 882
     REP_RET
... ...
@@ -35,12 +35,20 @@
35 35
 #include "avio_internal.h"
36 36
 #include "flv.h"
37 37
 
38
+#define VALIDATE_INDEX_TS_THRESH 2500
39
+
38 40
 typedef struct {
39 41
     int wrong_dts; ///< wrong dts due to negative cts
40 42
     uint8_t *new_extradata[FLV_STREAM_TYPE_NB];
41 43
     int      new_extradata_size[FLV_STREAM_TYPE_NB];
42 44
     int      last_sample_rate;
43 45
     int      last_channels;
46
+    struct {
47
+        int64_t dts;
48
+        int64_t pos;
49
+    } validate_index[2];
50
+    int validate_next;
51
+    int validate_count;
44 52
 } FLVContext;
45 53
 
46 54
 static int flv_probe(AVProbeData *p)
... ...
@@ -137,6 +145,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
137 137
 }
138 138
 
139 139
 static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
140
+    FLVContext *flv = s->priv_data;
140 141
     unsigned int timeslen = 0, fileposlen = 0, i;
141 142
     char str_val[256];
142 143
     int64_t *times = NULL;
... ...
@@ -192,18 +201,15 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
192 192
     }
193 193
 
194 194
     if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {
195
-        int64_t av_unused dts, size0, size1;
196
-        avio_seek(ioc, filepositions[1]-4, SEEK_SET);
197
-        size0 = avio_rb32(ioc);
198
-                avio_r8(ioc);
199
-        size1 = avio_rb24(ioc);
200
-        dts   = avio_rb24(ioc);
201
-        dts  |= avio_r8(ioc) << 24;
202
-        if (size0 > filepositions[1] || FFABS(dts - times[1]*1000)>5000/*arbitraray threshold to detect invalid index*/)
203
-            goto invalid;
204
-        for(i = 0; i < timeslen; i++)
195
+        for (i = 0; i < fileposlen; i++) {
205 196
             av_add_index_entry(vstream, filepositions[i], times[i]*1000,
206 197
                                0, 0, AVINDEX_KEYFRAME);
198
+            if (i < 2) {
199
+                flv->validate_index[i].pos = filepositions[i];
200
+                flv->validate_index[i].dts = times[i] * 1000;
201
+                flv->validate_count = i + 1;
202
+            }
203
+        }
207 204
     } else {
208 205
 invalid:
209 206
         av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
... ...
@@ -444,6 +450,22 @@ static int flv_queue_extradata(FLVContext *flv, AVIOContext *pb, int stream,
444 444
     return 0;
445 445
 }
446 446
 
447
+static void clear_index_entries(AVFormatContext *s, int64_t pos)
448
+{
449
+    int i, j, out;
450
+    av_log(s, AV_LOG_WARNING, "Found invalid index entries, clearing the index.\n");
451
+    for (i = 0; i < s->nb_streams; i++) {
452
+        AVStream *st = s->streams[i];
453
+        /* Remove all index entries that point to >= pos */
454
+        out = 0;
455
+        for (j = 0; j < st->nb_index_entries; j++) {
456
+            if (st->index_entries[j].pos < pos)
457
+                st->index_entries[out++] = st->index_entries[j];
458
+        }
459
+        st->nb_index_entries = out;
460
+    }
461
+}
462
+
447 463
 static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
448 464
 {
449 465
     FLVContext *flv = s->priv_data;
... ...
@@ -467,6 +489,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
467 467
     avio_skip(s->pb, 3); /* stream id, always 0 */
468 468
     flags = 0;
469 469
 
470
+    if (flv->validate_next < flv->validate_count) {
471
+        int64_t validate_pos = flv->validate_index[flv->validate_next].pos;
472
+        if (pos == validate_pos) {
473
+            if (FFABS(dts - flv->validate_index[flv->validate_next].dts) <=
474
+                VALIDATE_INDEX_TS_THRESH) {
475
+                flv->validate_next++;
476
+            } else {
477
+                clear_index_entries(s, validate_pos);
478
+                flv->validate_count = 0;
479
+            }
480
+        } else if (pos > validate_pos) {
481
+            clear_index_entries(s, validate_pos);
482
+            flv->validate_count = 0;
483
+        }
484
+    }
485
+
470 486
     if(size == 0)
471 487
         continue;
472 488
 
... ...
@@ -654,6 +692,8 @@ leave:
654 654
 static int flv_read_seek(AVFormatContext *s, int stream_index,
655 655
     int64_t ts, int flags)
656 656
 {
657
+    FLVContext *flv = s->priv_data;
658
+    flv->validate_count = 0;
657 659
     return avio_seek_time(s->pb, stream_index, ts, flags);
658 660
 }
659 661
 
... ...
@@ -565,6 +565,42 @@ static int mov_get_lpcm_flags(enum CodecID codec_id)
565 565
     }
566 566
 }
567 567
 
568
+static int get_cluster_duration(MOVTrack *track, int cluster_idx)
569
+{
570
+    int64_t next_dts;
571
+
572
+    if (cluster_idx >= track->entry)
573
+        return 0;
574
+
575
+    if (cluster_idx + 1 == track->entry)
576
+        next_dts = track->track_duration + track->start_dts;
577
+    else
578
+        next_dts = track->cluster[cluster_idx + 1].dts;
579
+
580
+    return next_dts - track->cluster[cluster_idx].dts;
581
+}
582
+
583
+static int get_samples_per_packet(MOVTrack *track)
584
+{
585
+    int i, first_duration;
586
+
587
+// return track->enc->frame_size;
588
+
589
+    /* use 1 for raw PCM */
590
+    if (!track->audio_vbr)
591
+        return 1;
592
+
593
+    /* check to see if duration is constant for all clusters */
594
+    if (!track->entry)
595
+        return 0;
596
+    first_duration = get_cluster_duration(track, 0);
597
+    for (i = 1; i < track->entry; i++) {
598
+        if (get_cluster_duration(track, i) != first_duration)
599
+            return 0;
600
+    }
601
+    return first_duration;
602
+}
603
+
568 604
 static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
569 605
 {
570 606
     int64_t pos = avio_tell(pb);
... ...
@@ -607,7 +643,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
607 607
         avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
608 608
         avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));
609 609
         avio_wb32(pb, track->sample_size);
610
-        avio_wb32(pb, track->enc->frame_size);
610
+        avio_wb32(pb, get_samples_per_packet(track));
611 611
     } else {
612 612
         if (track->mode == MODE_MOV) {
613 613
             avio_wb16(pb, track->enc->channels);
... ...
@@ -1143,9 +1179,7 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
1143 1143
                        av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */
1144 1144
                        NULL;
1145 1145
         for (i=0; i<track->entry; i++) {
1146
-            int64_t duration = i + 1 == track->entry ?
1147
-                track->track_duration - track->cluster[i].dts + track->start_dts : /* readjusting */
1148
-                track->cluster[i+1].dts - track->cluster[i].dts;
1146
+            int duration = get_cluster_duration(track, i);
1149 1147
             if (i && duration == stts_entries[entries].duration) {
1150 1148
                 stts_entries[entries].count++; /* compress */
1151 1149
             } else {
... ...
@@ -2262,7 +2296,7 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track,
2262 2262
     if (flags & MOV_TFHD_BASE_DATA_OFFSET)
2263 2263
         avio_wb64(pb, moof_offset);
2264 2264
     if (flags & MOV_TFHD_DEFAULT_DURATION) {
2265
-        track->default_duration = track->audio_vbr ? track->enc->frame_size : 1;
2265
+        track->default_duration = get_cluster_duration(track, 0);
2266 2266
         avio_wb32(pb, track->default_duration);
2267 2267
     }
2268 2268
     if (flags & MOV_TFHD_DEFAULT_SIZE) {
... ...
@@ -2295,10 +2329,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
2295 2295
     int i;
2296 2296
 
2297 2297
     for (i = 0; i < track->entry; i++) {
2298
-        int64_t duration = i + 1 == track->entry ?
2299
-            track->track_duration - track->cluster[i].dts + track->start_dts :
2300
-            track->cluster[i + 1].dts - track->cluster[i].dts;
2301
-        if (duration != track->default_duration)
2298
+        if (get_cluster_duration(track, i) != track->default_duration)
2302 2299
             flags |= MOV_TRUN_SAMPLE_DURATION;
2303 2300
         if (track->cluster[i].size != track->default_size)
2304 2301
             flags |= MOV_TRUN_SAMPLE_SIZE;
... ...
@@ -2322,11 +2353,8 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
2322 2322
         avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
2323 2323
 
2324 2324
     for (i = 0; i < track->entry; i++) {
2325
-        int64_t duration = i + 1 == track->entry ?
2326
-            track->track_duration - track->cluster[i].dts + track->start_dts :
2327
-            track->cluster[i + 1].dts - track->cluster[i].dts;
2328 2325
         if (flags & MOV_TRUN_SAMPLE_DURATION)
2329
-            avio_wb32(pb, duration);
2326
+            avio_wb32(pb, get_cluster_duration(track, i));
2330 2327
         if (flags & MOV_TRUN_SAMPLE_SIZE)
2331 2328
             avio_wb32(pb, track->cluster[i].size);
2332 2329
         if (flags & MOV_TRUN_SAMPLE_FLAGS)
... ...
@@ -900,9 +900,13 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
900 900
     char buf[4096], buf1[1024], *q;
901 901
     unsigned char ch;
902 902
     const char *p;
903
-    int ret, content_length, line_count = 0;
903
+    int ret, content_length, line_count = 0, request = 0;
904 904
     unsigned char *content = NULL;
905 905
 
906
+start:
907
+    line_count = 0;
908
+    request = 0;
909
+    content = NULL;
906 910
     memset(reply, 0, sizeof(*reply));
907 911
 
908 912
     /* parse reply (XXX: use buffers) */
... ...
@@ -938,9 +942,15 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
938 938
         if (line_count == 0) {
939 939
             /* get reply code */
940 940
             get_word(buf1, sizeof(buf1), &p);
941
-            get_word(buf1, sizeof(buf1), &p);
942
-            reply->status_code = atoi(buf1);
943
-            av_strlcpy(reply->reason, p, sizeof(reply->reason));
941
+            if (!strncmp(buf1, "RTSP/", 5)) {
942
+                get_word(buf1, sizeof(buf1), &p);
943
+                reply->status_code = atoi(buf1);
944
+                av_strlcpy(reply->reason, p, sizeof(reply->reason));
945
+            } else {
946
+                av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method
947
+                get_word(buf1, sizeof(buf1), &p); // object
948
+                request = 1;
949
+            }
944 950
         } else {
945 951
             ff_rtsp_parse_line(reply, p, rt, method);
946 952
             av_strlcat(rt->last_reply, p,    sizeof(rt->last_reply));
... ...
@@ -949,7 +959,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
949 949
         line_count++;
950 950
     }
951 951
 
952
-    if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0')
952
+    if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0' && !request)
953 953
         av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));
954 954
 
955 955
     content_length = reply->content_length;
... ...
@@ -964,6 +974,44 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
964 964
     else
965 965
         av_free(content);
966 966
 
967
+    if (request) {
968
+        char buf[1024];
969
+        char base64buf[AV_BASE64_SIZE(sizeof(buf))];
970
+        const char* ptr = buf;
971
+
972
+        if (!strcmp(reply->reason, "OPTIONS")) {
973
+            snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");
974
+            if (reply->seq)
975
+                av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);
976
+            if (reply->session_id[0])
977
+                av_strlcatf(buf, sizeof(buf), "Session: %s\r\n",
978
+                                              reply->session_id);
979
+        } else {
980
+            snprintf(buf, sizeof(buf), "RTSP/1.0 501 Not Implemented\r\n");
981
+        }
982
+        av_strlcat(buf, "\r\n", sizeof(buf));
983
+
984
+        if (rt->control_transport == RTSP_MODE_TUNNEL) {
985
+            av_base64_encode(base64buf, sizeof(base64buf), buf, strlen(buf));
986
+            ptr = base64buf;
987
+        }
988
+        ffurl_write(rt->rtsp_hd_out, ptr, strlen(ptr));
989
+
990
+        rt->last_cmd_time = av_gettime();
991
+        /* Even if the request from the server had data, it is not the data
992
+         * that the caller wants or expects. The memory could also be leaked
993
+         * if the actual following reply has content data. */
994
+        if (content_ptr)
995
+            av_freep(content_ptr);
996
+        /* If method is set, this is called from ff_rtsp_send_cmd,
997
+         * where a reply to exactly this request is awaited. For
998
+         * callers from within packet reciving, we just want to
999
+         * return to the caller and go back to receiving packets. */
1000
+        if (method)
1001
+            goto start;
1002
+        return 0;
1003
+    }
1004
+
967 1005
     if (rt->seq != reply->seq) {
968 1006
         av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",
969 1007
             rt->seq, reply->seq);
... ...
@@ -15,3 +15,4 @@ fate-lossless-tta: CMD = crc -i $(SAMPLES)/lossless-audio/inside.tta
15 15
 
16 16
 FATE_TESTS += $(FATE_LOSSLESS_AUDIO)
17 17
 fate-lossless-audio: $(FATE_LOSSLESS_AUDIO)
18
+