History

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

Michael Niedermayer committed 14 years ago

Commit e3822882 parents f1808e3 d10319d9 files · +1162 −1044Browse files

Unified · Split

9 files
  1. doc/APIchanges +5 −5
  2. libavcodec/avcodec.h +1009 −1008
  3. libavcodec/pthread.c +1 −1
  4. libavcodec/utils.c +1 −1
  5. libavcodec/x86/h264_deblock_10bit.asm +1 −1
  6. libavformat/flvdec.c +50 −10
  7. libavformat/movenc.c +41 −13
  8. libavformat/rtsp.c +53 −5
  9. tests/fate/lossless-audio.mak +1 −0
doc/APIchanges+5−5
@@ -35,19 +35,19 @@ API changes, most recent first: · 34 unmodified lines
3535 2012-01-24 - xxxxxxx - lavfi 2.60.100
3636 Add avfilter_graph_dump.
3737
38−2012-xx-xx - xxxxxxx - lavu 51.24.0 - error.h
38+2012-02-25 - c9bca80 - lavu 51.24.0 - error.h
3939 Add AVERROR_UNKNOWN
4040
41−2012-xx-xx - xxxxxxx - lavc 54.x.x
41+2012-02-20 - e9cda85 - lavc 54.2.0
4242 Add duration field to AVCodecParserContext
4343
44−2012-02-xx - xxxxxxx - lavu 51.23.1 - mathematics.h
44+2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h
4545 Add av_rescale_q_rnd()
4646
47−2012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h
47+2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h
4848 Add PIX_FMT_PSEUDOPAL flag.
4949
50−2012-02-01 - xxxxxxx - lavc 54.01.0
50+2012-02-08 - 52f82a1 - lavc 54.01.0
5151 Add avcodec_encode_video2() and deprecate avcodec_encode_video().
5252
5353 2012-02-01 - 316fc74 - lavc 54.01.0
libavcodec/avcodec.h+1009−1008
@@ -891,12 +891,48 @@ typedef struct AVFrame { · 890 unmodified lines
891891 int linesize[AV_NUM_DATA_POINTERS];
892892
893893 /**
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()
898910 */
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+
900936 /**
901937 * 1 -> keyframe, 0-> not
902938 * - encoding: Set by libavcodec.
@@ -911,6 +947,21 @@ typedef struct AVFrame { · 8 unmodified lines
911947 */
912948 enum AVPictureType pict_type;
913949
950+ /**
951+ * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
952+ * This isn't used by libavcodec unless the default get/release_buffer() is used.
953+ * - encoding:
954+ * - decoding:
955+ */
956+ uint8_t *base[AV_NUM_DATA_POINTERS];
957+
958+ /**
959+ * sample aspect ratio for the video frame, 0/1 if unknown\unspecified
960+ * - encoding: unused
961+ * - decoding: Read by user.
962+ */
963+ AVRational sample_aspect_ratio;
964+
914965 /**
915966 * presentation timestamp in time_base units (time when frame should be shown to user)
916967 * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
@@ -919,6 +970,20 @@ typedef struct AVFrame { · 2 unmodified lines
919970 */
920971 int64_t pts;
921972
973+ /**
974+ * reordered pts from the last AVPacket that has been input into the decoder
975+ * - encoding: unused
976+ * - decoding: Read by user.
977+ */
978+ int64_t pkt_pts;
979+
980+ /**
981+ * dts from the last AVPacket that has been input into the decoder
982+ * - encoding: unused
983+ * - decoding: Read by user.
984+ */
985+ int64_t pkt_dts;
986+
922987 /**
923988 * picture number in bitstream order
924989 * - encoding: set by
@@ -962,6 +1027,11 @@ typedef struct AVFrame { · 37 unmodified lines
9621027 */
9631028 int qstride;
9641029
1030+ /**
1031+ *
1032+ */
1033+ int qscale_type;
1034+
9651035 /**
9661036 * mbskip_table[mb]>=1 if MB didn't change
9671037 * stride= mb_width = (width+15)>>4
@@ -993,12 +1063,19 @@ typedef struct AVFrame { · 25 unmodified lines
9931063 uint32_t *mb_type;
9941064
9951065 /**
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)
1066+ * DCT coefficients
9981067 * - encoding: unused
9991068 * - decoding: Set by libavcodec.
10001069 */
1001− uint8_t motion_subsample_log2;
1070+ short *dct_coeff;
1071+
1072+ /**
1073+ * motion reference frame index
1074+ * the order in which these are stored can depend on the codec.
1075+ * - encoding: Set by user.
1076+ * - decoding: Set by libavcodec.
1077+ */
1078+ int8_t *ref_index[2];
10021079
10031080 /**
10041081 * for some private data of the user
@@ -1030,11 +1107,6 @@ typedef struct AVFrame { · 25 unmodified lines
10301107 */
10311108 int repeat_pict;
10321109
1033− /**
1034− *
1035− */
1036− int qscale_type;
1037−
10381110 /**
10391111 * The content of the picture is interlaced.
10401112 * - encoding: Set by user.
@@ -1049,13 +1121,6 @@ typedef struct AVFrame { · 8 unmodified lines
10491121 */
10501122 int top_field_first;
10511123
1052− /**
1053− * Pan scan.
1054− * - encoding: Set by user.
1055− * - decoding: Set by libavcodec.
1056− */
1057− AVPanScan *pan_scan;
1058−
10591124 /**
10601125 * Tell user application that palette has changed from previous frame.
10611126 * - encoding: ??? (no palette-enabled encoder yet)
@@ -1071,19 +1136,11 @@ typedef struct AVFrame { · 9 unmodified lines
10711136 int buffer_hints;
10721137
10731138 /**
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.
1139+ * Pan scan.
10831140 * - encoding: Set by user.
10841141 * - decoding: Set by libavcodec.
10851142 */
1086− int8_t *ref_index[2];
1143+ AVPanScan *pan_scan;
10871144
10881145 /**
10891146 * reordered opaque 64bit (generally an integer or a double precision float
@@ -1105,20 +1162,6 @@ typedef struct AVFrame { · 15 unmodified lines
11051162 */
11061163 void *hwaccel_picture_private;
11071164
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−
11221165 /**
11231166 * the AVCodecContext which ff_thread_get_buffer() was last called on
11241167 * - encoding: Set by libavcodec.
@@ -1134,54 +1177,12 @@ typedef struct AVFrame { · 9 unmodified lines
11341177 void *thread_opaque;
11351178
11361179 /**
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)
1180+ * log2 of the size of the block which a single vector in motion_val represents:
1181+ * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
11811182 * - encoding: unused
1182− * - decoding: Read by user.
1183+ * - decoding: Set by libavcodec.
11831184 */
1184− int format;
1185+ uint8_t motion_subsample_log2;
11851186
11861187 /**
11871188 * frame timestamp estimated using various heuristics, in stream time base
@@ -1200,7 +1201,6 @@ typedef struct AVFrame { · 12 unmodified lines
12001201 * - decoding: Read by user.
12011202 */
12021203 int64_t pkt_pos;
1203−
12041204 } AVFrame;
12051205
12061206 struct AVCodecInternal;
@@ -1229,27 +1229,35 @@ typedef struct AVCodecContext { · 22 unmodified lines
12291229 * - set by avcodec_alloc_context3
12301230 */
12311231 const AVClass *av_class;
1232− /**
1233− * the average bitrate
1234− * - encoding: Set by user; unused for constant quantizer encoding.
1235− * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
1236− */
1237− int bit_rate;
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 */
12381238
12391239 /**
1240− * number of bits the bitstream is allowed to diverge from the reference.
1241− * the reference can be CBR (for CBR pass1) or VBR (for pass2)
1242− * - encoding: Set by user; unused for constant quantizer encoding.
1243− * - decoding: unused
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.
12441251 */
1245− int bit_rate_tolerance;
1252+ unsigned int codec_tag;
12461253
12471254 /**
1248− * CODEC_FLAG_*.
1249− * - encoding: Set by user.
1250− * - decoding: Set by user.
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.
12511259 */
1252− int flags;
1260+ unsigned int stream_codec_tag;
12531261
12541262 /**
12551263 * Some codecs need additional format info. It is stored here.
@@ -1261,111 +1269,99 @@ typedef struct AVCodecContext { · 5 unmodified lines
12611269 */
12621270 int sub_id;
12631271
1272+ void *priv_data;
1273+
12641274 /**
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
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.
12701279 */
1271− int me_method;
1280+ struct AVCodecInternal *internal;
12721281
12731282 /**
1274− * some codecs need / can use extradata like Huffman tables.
1275− * mjpeg: Huffman tables
1276− * rv10: additional flags
1277− * mpeg4: global headers (they can be in the bitstream or here)
1278− * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
1279− * than extradata_size to avoid prolems if it is read with the bitstream reader.
1280− * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1281− * - encoding: Set/allocated/freed by libavcodec.
1282− * - decoding: Set/allocated/freed by user.
1283+ * Private data of the user, can be used to carry app specific stuff.
1284+ * - encoding: Set by user.
1285+ * - decoding: Set by user.
12831286 */
1284− uint8_t *extradata;
1285− int extradata_size;
1287+ void *opaque;
12861288
12871289 /**
1288− * This is the fundamental unit of time (in seconds) in terms
1289− * of which frame timestamps are represented. For fixed-fps content,
1290− * timebase should be 1/framerate and timestamp increments should be
1291− * identically 1.
1292− * - encoding: MUST be set by user.
1293− * - decoding: Set by libavcodec.
1290+ * the average bitrate
1291+ * - encoding: Set by user; unused for constant quantizer encoding.
1292+ * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
12941293 */
1295− AVRational time_base;
1294+ int bit_rate;
12961295
1297− /* video only */
12981296 /**
1299− * picture width / height.
1300− * - encoding: MUST be set by user.
1301− * - decoding: Set by libavcodec.
1302− * Note: For compatibility it is possible to set this instead of
1303− * coded_width/height before decoding.
1297+ * number of bits the bitstream is allowed to diverge from the reference.
1298+ * the reference can be CBR (for CBR pass1) or VBR (for pass2)
1299+ * - encoding: Set by user; unused for constant quantizer encoding.
1300+ * - decoding: unused
13041301 */
1305− int width, height;
1302+ int bit_rate_tolerance;
13061303
1307−#define FF_ASPECT_EXTENDED 15
1304+ /**
1305+ * Global quality for codecs which cannot change it per frame.
1306+ * This should be proportional to MPEG-1/2/4 qscale.
1307+ * - encoding: Set by user.
1308+ * - decoding: unused
1309+ */
1310+ int global_quality;
13081311
13091312 /**
1310− * the number of pictures in a group of pictures, or 0 for intra_only
13111313 * - encoding: Set by user.
13121314 * - decoding: unused
13131315 */
1314− int gop_size;
1316+ int compression_level;
1317+#define FF_COMPRESSION_DEFAULT -1
13151318
13161319 /**
1317− * Pixel format, see PIX_FMT_xxx.
1318− * May be set by the demuxer if known from headers.
1319− * May be overriden by the decoder if it knows better.
1320+ * CODEC_FLAG_*.
13201321 * - encoding: Set by user.
1321− * - decoding: Set by user if known, overridden by libavcodec if known
1322+ * - decoding: Set by user.
13221323 */
1323− enum PixelFormat pix_fmt;
1324+ int flags;
13241325
13251326 /**
1326− * If non NULL, 'draw_horiz_band' is called by the libavcodec
1327− * decoder to draw a horizontal band. It improves cache usage. Not
1328− * all codecs can do that. You must check the codec capabilities
1329− * beforehand.
1330− * When multithreading is used, it may be called from multiple threads
1331− * at the same time; threads might draw different parts of the same AVFrame,
1332− * or multiple AVFrames, and there is no guarantee that slices will be drawn
1333− * in order.
1334− * The function is also used by hardware acceleration APIs.
1335− * It is called at least once during frame decoding to pass
1336− * the data needed for hardware render.
1337− * In that mode instead of pixel data, AVFrame points to
1338− * a structure specific to the acceleration API. The application
1339− * reads the structure and can change some fields to indicate progress
1340− * or mark state.
1341− * - encoding: unused
1327+ * CODEC_FLAG2_*
1328+ * - encoding: Set by user.
13421329 * - decoding: Set by user.
1343− * @param height the height of the slice
1344− * @param y the y position of the slice
1345− * @param type 1->top field, 2->bottom field, 3->frame
1346− * @param offset offset into the AVFrame.data from which the slice should be read
13471330 */
1348− void (*draw_horiz_band)(struct AVCodecContext *s,
1349− const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1350− int y, int type, int height);
1331+ int flags2;
13511332
1352− /* audio only */
1353− int sample_rate; ///< samples per second
1354− int channels; ///< number of audio channels
1333+ /**
1334+ * some codecs need / can use extradata like Huffman tables.
1335+ * mjpeg: Huffman tables
1336+ * rv10: additional flags
1337+ * mpeg4: global headers (they can be in the bitstream or here)
1338+ * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
1339+ * than extradata_size to avoid prolems if it is read with the bitstream reader.
1340+ * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1341+ * - encoding: Set/allocated/freed by libavcodec.
1342+ * - decoding: Set/allocated/freed by user.
1343+ */
1344+ uint8_t *extradata;
1345+ int extradata_size;
13551346
13561347 /**
1357− * audio sample format
1358− * - encoding: Set by user.
1348+ * This is the fundamental unit of time (in seconds) in terms
1349+ * of which frame timestamps are represented. For fixed-fps content,
1350+ * timebase should be 1/framerate and timestamp increments should be
1351+ * identically 1.
1352+ * - encoding: MUST be set by user.
13591353 * - decoding: Set by libavcodec.
13601354 */
1361− enum AVSampleFormat sample_fmt; ///< sample format
1355+ AVRational time_base;
13621356
1363− /* The following data should not be initialized. */
13641357 /**
1365− * Samples per packet, initialized when calling 'init'.
1358+ * For some codecs, the time base is closer to the field rate than the frame rate.
1359+ * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
1360+ * if no telecine is used ...
1361+ *
1362+ * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
13661363 */
1367− int frame_size;
1368− int frame_number; ///< audio or video frame number
1364+ int ticks_per_frame;
13691365
13701366 /**
13711367 * Encoding: Number of frames delay there will be from the encoder input to
@@ -1390,30 +1386,88 @@ typedef struct AVCodecContext { · 18 unmodified lines
13901386 */
13911387 int delay;
13921388
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)
13961389
1390+ /* video only */
13971391 /**
1398− * minimum quantizer
1399− * - encoding: Set by user.
1400− * - decoding: unused
1392+ * picture width / height.
1393+ * - encoding: MUST be set by user.
1394+ * - decoding: Set by libavcodec.
1395+ * Note: For compatibility it is possible to set this instead of
1396+ * coded_width/height before decoding.
14011397 */
1402− int qmin;
1398+ int width, height;
14031399
14041400 /**
1405− * maximum quantizer
1401+ * Bitstream width / height, may be different from width/height if lowres enabled.
1402+ * - encoding: unused
1403+ * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
1404+ */
1405+ int coded_width, coded_height;
1406+
1407+#define FF_ASPECT_EXTENDED 15
1408+
1409+ /**
1410+ * the number of pictures in a group of pictures, or 0 for intra_only
14061411 * - encoding: Set by user.
14071412 * - decoding: unused
14081413 */
1409− int qmax;
1414+ int gop_size;
14101415
14111416 /**
1412− * maximum quantizer difference between frames
1417+ * Pixel format, see PIX_FMT_xxx.
1418+ * May be set by the demuxer if known from headers.
1419+ * May be overriden by the decoder if it knows better.
14131420 * - encoding: Set by user.
1421+ * - decoding: Set by user if known, overridden by libavcodec if known
1422+ */
1423+ enum PixelFormat pix_fmt;
1424+
1425+ /**
1426+ * Motion estimation algorithm used for video coding.
1427+ * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
1428+ * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
1429+ * - encoding: MUST be set by user.
14141430 * - decoding: unused
14151431 */
1416− int max_qdiff;
1432+ int me_method;
1433+
1434+ /**
1435+ * If non NULL, 'draw_horiz_band' is called by the libavcodec
1436+ * decoder to draw a horizontal band. It improves cache usage. Not
1437+ * all codecs can do that. You must check the codec capabilities
1438+ * beforehand.
1439+ * When multithreading is used, it may be called from multiple threads
1440+ * at the same time; threads might draw different parts of the same AVFrame,
1441+ * or multiple AVFrames, and there is no guarantee that slices will be drawn
1442+ * in order.
1443+ * The function is also used by hardware acceleration APIs.
1444+ * It is called at least once during frame decoding to pass
1445+ * the data needed for hardware render.
1446+ * In that mode instead of pixel data, AVFrame points to
1447+ * a structure specific to the acceleration API. The application
1448+ * reads the structure and can change some fields to indicate progress
1449+ * or mark state.
1450+ * - encoding: unused
1451+ * - decoding: Set by user.
1452+ * @param height the height of the slice
1453+ * @param y the y position of the slice
1454+ * @param type 1->top field, 2->bottom field, 3->frame
1455+ * @param offset offset into the AVFrame.data from which the slice should be read
1456+ */
1457+ void (*draw_horiz_band)(struct AVCodecContext *s,
1458+ const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1459+ int y, int type, int height);
1460+
1461+ /**
1462+ * callback to negotiate the pixelFormat
1463+ * @param fmt is the list of formats which are supported by the codec,
1464+ * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1465+ * The first is always the native one.
1466+ * @return the chosen format
1467+ * - encoding: unused
1468+ * - decoding: Set by user, if not set the native format will be chosen.
1469+ */
1470+ enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
14171471
14181472 /**
14191473 * maximum number of B-frames between non-B-frames
@@ -1438,739 +1492,637 @@ typedef struct AVCodecContext { · 18 unmodified lines
14381492
14391493 int b_frame_strategy;
14401494
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−
1495+ /**
1496+ * luma single coefficient elimination threshold
1497+ * - encoding: Set by user.
1498+ * - decoding: unused
1499+ */
1500+ int luma_elim_threshold;
14521501
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);
1502+ /**
1503+ * chroma single coeff elimination threshold
1504+ * - encoding: Set by user.
1505+ * - decoding: unused
1506+ */
1507+ int chroma_elim_threshold;
14601508
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;
1509+ /**
1510+ * qscale offset between IP and B-frames
1511+ * - encoding: Set by user.
1512+ * - decoding: unused
1513+ */
1514+ float b_quant_offset;
14701515
14711516 /**
1472− * number of bits used for the previously encoded frame
1517+ * Size of the frame reordering buffer in the decoder.
1518+ * For MPEG-2 it is 1 IPB or 0 low delay IP.
14731519 * - encoding: Set by libavcodec.
1474− * - decoding: unused
1520+ * - decoding: Set by libavcodec.
14751521 */
1476− int frame_bits;
1522+ int has_b_frames;
14771523
14781524 /**
1479− * Private data of the user, can be used to carry app specific stuff.
1525+ * 0-> h263 quant 1-> mpeg quant
14801526 * - encoding: Set by user.
1481− * - decoding: Set by user.
1527+ * - decoding: unused
14821528 */
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 */
1529+ int mpeg_quant;
14881530
14891531 /**
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.
1532+ * qscale factor between P and I-frames
1533+ * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1534+ * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1535+ * - encoding: Set by user.
1536+ * - decoding: unused
15011537 */
1502− unsigned int codec_tag;
1538+ float i_quant_factor;
15031539
15041540 /**
1505− * Work around bugs in encoders which sometimes cannot be detected automatically.
1506− * - encoding: Set by user
1507− * - decoding: Set by user
1541+ * qscale offset between P and I-frames
1542+ * - encoding: Set by user.
1543+ * - decoding: unused
15081544 */
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
1545+ float i_quant_offset;
15261546
15271547 /**
1528− * luma single coefficient elimination threshold
1548+ * luminance masking (0-> disabled)
15291549 * - encoding: Set by user.
15301550 * - decoding: unused
15311551 */
1532− int luma_elim_threshold;
1552+ float lumi_masking;
15331553
15341554 /**
1535− * chroma single coeff elimination threshold
1555+ * temporary complexity masking (0-> disabled)
15361556 * - encoding: Set by user.
15371557 * - decoding: unused
15381558 */
1539− int chroma_elim_threshold;
1559+ float temporal_cplx_masking;
15401560
15411561 /**
1542− * strictly follow the standard (MPEG4, ...).
1562+ * spatial complexity masking (0-> disabled)
15431563 * - 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)
1564+ * - decoding: unused
15521565 */
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.
1566+ float spatial_cplx_masking;
15591567
15601568 /**
1561− * qscale offset between IP and B-frames
1569+ * p block masking (0-> disabled)
15621570 * - encoding: Set by user.
15631571 * - decoding: unused
15641572 */
1565− float b_quant_offset;
1573+ float p_masking;
15661574
15671575 /**
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.
1576+ * darkness masking (0-> disabled)
1577+ * - encoding: Set by user.
1578+ * - decoding: unused
16211579 */
1622− int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
1580+ float dark_masking;
16231581
16241582 /**
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.
1583+ * slice count
1584+ * - encoding: Set by libavcodec.
1585+ * - decoding: Set by user (or 0).
16321586 */
1633− void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1634−
1587+ int slice_count;
16351588 /**
1636− * Size of the frame reordering buffer in the decoder.
1637− * For MPEG-2 it is 1 IPB or 0 low delay IP.
1638− * - encoding: Set by libavcodec.
1639− * - decoding: Set by libavcodec.
1589+ * prediction method (needed for huffyuv)
1590+ * - encoding: Set by user.
1591+ * - decoding: unused
16401592 */
1641− int has_b_frames;
1593+ int prediction_method;
1594+#define FF_PRED_LEFT 0
1595+#define FF_PRED_PLANE 1
1596+#define FF_PRED_MEDIAN 2
16421597
16431598 /**
1644− * number of bytes per packet if constant and known or 0
1645− * Used by some WAV based audio codecs.
1599+ * slice offsets in the frame in bytes
1600+ * - encoding: Set/allocated by libavcodec.
1601+ * - decoding: Set/allocated by user (or NULL).
16461602 */
1647− int block_align;
1603+ int *slice_offset;
16481604
16491605 /**
1650− * 0-> h263 quant 1-> mpeg quant
1606+ * sample aspect ratio (0 if unknown)
1607+ * That is the width of a pixel divided by the height of the pixel.
1608+ * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
16511609 * - encoding: Set by user.
1652− * - decoding: unused
1610+ * - decoding: Set by libavcodec.
16531611 */
1654− int mpeg_quant;
1612+ AVRational sample_aspect_ratio;
16551613
16561614 /**
1657− * pass1 encoding statistics output buffer
1658− * - encoding: Set by libavcodec.
1615+ * motion estimation comparison function
1616+ * - encoding: Set by user.
16591617 * - decoding: unused
16601618 */
1661− char *stats_out;
1662−
1619+ int me_cmp;
16631620 /**
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.
1621+ * subpixel motion estimation comparison function
1622+ * - encoding: Set by user.
16671623 * - decoding: unused
16681624 */
1669− char *stats_in;
1670−
1625+ int me_sub_cmp;
16711626 /**
1672− * ratecontrol qmin qmax limiting method
1673− * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
1627+ * macroblock comparison function (not supported yet)
16741628 * - encoding: Set by user.
16751629 * - decoding: unused
16761630 */
1677− float rc_qsquish;
1678−
1679− float rc_qmod_amp;
1680− int rc_qmod_freq;
1681−
1631+ int mb_cmp;
16821632 /**
1683− * ratecontrol override, see RcOverride
1684− * - encoding: Allocated/set/freed by user.
1633+ * interlaced DCT comparison function
1634+ * - encoding: Set by user.
16851635 * - decoding: unused
16861636 */
1687− RcOverride *rc_override;
1688− int rc_override_count;
1637+ int ildct_cmp;
1638+#define FF_CMP_SAD 0
1639+#define FF_CMP_SSE 1
1640+#define FF_CMP_SATD 2
1641+#define FF_CMP_DCT 3
1642+#define FF_CMP_PSNR 4
1643+#define FF_CMP_BIT 5
1644+#define FF_CMP_RD 6
1645+#define FF_CMP_ZERO 7
1646+#define FF_CMP_VSAD 8
1647+#define FF_CMP_VSSE 9
1648+#define FF_CMP_NSSE 10
1649+#define FF_CMP_W53 11
1650+#define FF_CMP_W97 12
1651+#define FF_CMP_DCTMAX 13
1652+#define FF_CMP_DCT264 14
1653+#define FF_CMP_CHROMA 256
16891654
16901655 /**
1691− * rate control equation
1692− * - encoding: Set by user
1656+ * ME diamond size & shape
1657+ * - encoding: Set by user.
16931658 * - decoding: unused
16941659 */
1695− const char *rc_eq;
1660+ int dia_size;
16961661
16971662 /**
1698− * maximum bitrate
1663+ * amount of previous MV predictors (2a+1 x 2a+1 square)
16991664 * - encoding: Set by user.
17001665 * - decoding: unused
17011666 */
1702− int rc_max_rate;
1667+ int last_predictor_count;
17031668
17041669 /**
1705− * minimum bitrate
1670+ * prepass for motion estimation
17061671 * - encoding: Set by user.
17071672 * - decoding: unused
17081673 */
1709− int rc_min_rate;
1674+ int pre_me;
17101675
17111676 /**
1712− * decoder bitstream buffer size
1677+ * motion estimation prepass comparison function
17131678 * - encoding: Set by user.
17141679 * - decoding: unused
17151680 */
1716− int rc_buffer_size;
1717− float rc_buffer_aggressivity;
1681+ int me_pre_cmp;
17181682
17191683 /**
1720− * qscale factor between P and I-frames
1721− * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1722− * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1684+ * ME prepass diamond size & shape
17231685 * - encoding: Set by user.
17241686 * - decoding: unused
17251687 */
1726− float i_quant_factor;
1688+ int pre_dia_size;
17271689
17281690 /**
1729− * qscale offset between P and I-frames
1691+ * subpel ME quality
17301692 * - encoding: Set by user.
17311693 * - decoding: unused
17321694 */
1733− float i_quant_offset;
1695+ int me_subpel_quality;
17341696
17351697 /**
1736− * initial complexity for pass1 ratecontrol
1737− * - encoding: Set by user.
1738− * - decoding: unused
1698+ * DTG active format information (additional aspect ratio
1699+ * information only used in DVB MPEG-2 transport streams)
1700+ * 0 if not set.
1701+ *
1702+ * - encoding: unused
1703+ * - decoding: Set by decoder.
17391704 */
1740− float rc_initial_cplx;
1705+ int dtg_active_format;
1706+#define FF_DTG_AFD_SAME 8
1707+#define FF_DTG_AFD_4_3 9
1708+#define FF_DTG_AFD_16_9 10
1709+#define FF_DTG_AFD_14_9 11
1710+#define FF_DTG_AFD_4_3_SP_14_9 13
1711+#define FF_DTG_AFD_16_9_SP_14_9 14
1712+#define FF_DTG_AFD_SP_4_3 15
17411713
17421714 /**
1743− * DCT algorithm, see FF_DCT_* below
1715+ * maximum motion estimation search range in subpel units
1716+ * If 0 then no limit.
1717+ *
17441718 * - encoding: Set by user.
17451719 * - decoding: unused
17461720 */
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
1721+ int me_range;
17541722
17551723 /**
1756− * luminance masking (0-> disabled)
1724+ * intra quantizer bias
17571725 * - encoding: Set by user.
17581726 * - decoding: unused
17591727 */
1760− float lumi_masking;
1761−
1728+ int intra_quant_bias;
1729+#define FF_DEFAULT_QUANT_BIAS 999999
1730+
17621731 /**
1763− * temporary complexity masking (0-> disabled)
1732+ * inter quantizer bias
17641733 * - encoding: Set by user.
17651734 * - decoding: unused
17661735 */
1767− float temporal_cplx_masking;
1736+ int inter_quant_bias;
17681737
17691738 /**
1770− * spatial complexity masking (0-> disabled)
1771− * - encoding: Set by user.
1772− * - decoding: unused
1739+ * color table ID
1740+ * - encoding: unused
1741+ * - decoding: Which clrtable should be used for 8bit RGB images.
1742+ * Tables have to be stored somewhere. FIXME
17731743 */
1774− float spatial_cplx_masking;
1744+ int color_table_id;
17751745
17761746 /**
1777− * p block masking (0-> disabled)
1778− * - encoding: Set by user.
1779− * - decoding: unused
1747+ * slice flags
1748+ * - encoding: unused
1749+ * - decoding: Set by user.
17801750 */
1781− float p_masking;
1751+ int slice_flags;
1752+#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
1753+#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
1754+#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
17821755
17831756 /**
1784− * darkness masking (0-> disabled)
1757+ * XVideo Motion Acceleration
1758+ * - encoding: forbidden
1759+ * - decoding: set by decoder
1760+ */
1761+ int xvmc_acceleration;
1762+
1763+ /**
1764+ * macroblock decision mode
17851765 * - encoding: Set by user.
17861766 * - decoding: unused
17871767 */
1788− float dark_masking;
1768+ int mb_decision;
1769+#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
1770+#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
1771+#define FF_MB_DECISION_RD 2 ///< rate distortion
17891772
17901773 /**
1791− * IDCT algorithm, see FF_IDCT_* below.
1792− * - encoding: Set by user.
1793− * - decoding: Set by user.
1774+ * custom intra quantization matrix
1775+ * - encoding: Set by user, can be NULL.
1776+ * - decoding: Set by libavcodec.
17941777 */
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
1778+ uint16_t *intra_matrix;
18201779
18211780 /**
1822− * slice count
1823− * - encoding: Set by libavcodec.
1824− * - decoding: Set by user (or 0).
1781+ * custom inter quantization matrix
1782+ * - encoding: Set by user, can be NULL.
1783+ * - decoding: Set by libavcodec.
18251784 */
1826− int slice_count;
1785+ uint16_t *inter_matrix;
1786+
18271787 /**
1828− * slice offsets in the frame in bytes
1829− * - encoding: Set/allocated by libavcodec.
1830− * - decoding: Set/allocated by user (or NULL).
1788+ * scene change detection threshold
1789+ * 0 is default, larger means fewer detected scene changes.
1790+ * - encoding: Set by user.
1791+ * - decoding: unused
18311792 */
1832− int *slice_offset;
1793+ int scenechange_threshold;
18331794
18341795 /**
1835− * error concealment flags
1836− * - encoding: unused
1837− * - decoding: Set by user.
1796+ * noise reduction strength
1797+ * - encoding: Set by user.
1798+ * - decoding: unused
18381799 */
1839− int error_concealment;
1840−#define FF_EC_GUESS_MVS 1
1841−#define FF_EC_DEBLOCK 2
1800+ int noise_reduction;
18421801
18431802 /**
1844− * dsp_mask could be add used to disable unwanted CPU features
1845− * CPU features (i.e. MMX, SSE. ...)
18461803 *
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.)
1804+ * - encoding: Set by user.
1805+ * - decoding: unused
18501806 */
1851− unsigned dsp_mask;
1807+ int inter_threshold;
18521808
18531809 /**
1854− * bits per sample/pixel from the demuxer (needed for huffyuv).
1855− * - encoding: Set by libavcodec.
1856− * - decoding: Set by user.
1810+ * quantizer noise shaping
1811+ * - encoding: Set by user.
1812+ * - decoding: unused
18571813 */
1858− int bits_per_coded_sample;
1814+ int quantizer_noise_shaping;
18591815
18601816 /**
1861− * prediction method (needed for huffyuv)
1817+ * Motion estimation threshold below which no motion estimation is
1818+ * performed, but instead the user specified motion vectors are used.
1819+ *
18621820 * - encoding: Set by user.
18631821 * - decoding: unused
18641822 */
1865− int prediction_method;
1866−#define FF_PRED_LEFT 0
1867−#define FF_PRED_PLANE 1
1868−#define FF_PRED_MEDIAN 2
1823+ int me_threshold;
18691824
18701825 /**
1871− * sample aspect ratio (0 if unknown)
1872− * That is the width of a pixel divided by the height of the pixel.
1873− * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1826+ * Macroblock threshold below which the user specified macroblock types will be used.
18741827 * - encoding: Set by user.
1875− * - decoding: Set by libavcodec.
1828+ * - decoding: unused
18761829 */
1877− AVRational sample_aspect_ratio;
1830+ int mb_threshold;
18781831
18791832 /**
1880− * the picture in the bitstream
1881− * - encoding: Set by libavcodec.
1882− * - decoding: Set by libavcodec.
1833+ * precision of the intra DC coefficient - 8
1834+ * - encoding: Set by user.
1835+ * - decoding: unused
18831836 */
1884− AVFrame *coded_frame;
1837+ int intra_dc_precision;
18851838
18861839 /**
1887− * debug
1888− * - encoding: Set by user.
1840+ * Number of macroblock rows at the top which are skipped.
1841+ * - encoding: unused
18891842 * - decoding: Set by user.
18901843 */
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
1844+ int skip_top;
19091845
19101846 /**
1911− * debug
1912− * - encoding: Set by user.
1847+ * Number of macroblock rows at the bottom which are skipped.
1848+ * - encoding: unused
19131849 * - decoding: Set by user.
19141850 */
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
1851+ int skip_bottom;
19191852
19201853 /**
1921− * error
1922− * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
1854+ * Border processing masking, raises the quantizer for mbs on the borders
1855+ * of the picture.
1856+ * - encoding: Set by user.
19231857 * - decoding: unused
19241858 */
1925− uint64_t error[AV_NUM_DATA_POINTERS];
1859+ float border_masking;
19261860
19271861 /**
1928− * motion estimation comparison function
1862+ * minimum MB lagrange multipler
19291863 * - encoding: Set by user.
19301864 * - decoding: unused
19311865 */
1932− int me_cmp;
1866+ int mb_lmin;
1867+
19331868 /**
1934− * subpixel motion estimation comparison function
1869+ * maximum MB lagrange multipler
19351870 * - encoding: Set by user.
19361871 * - decoding: unused
19371872 */
1938− int me_sub_cmp;
1873+ int mb_lmax;
1874+
19391875 /**
1940− * macroblock comparison function (not supported yet)
1876+ *
19411877 * - encoding: Set by user.
19421878 * - decoding: unused
19431879 */
1944− int mb_cmp;
1880+ int me_penalty_compensation;
1881+
19451882 /**
1946− * interlaced DCT comparison function
1883+ *
19471884 * - encoding: Set by user.
19481885 * - decoding: unused
19491886 */
1950− int ildct_cmp;
1951−#define FF_CMP_SAD 0
1952−#define FF_CMP_SSE 1
1953−#define FF_CMP_SATD 2
1954−#define FF_CMP_DCT 3
1955−#define FF_CMP_PSNR 4
1956−#define FF_CMP_BIT 5
1957−#define FF_CMP_RD 6
1958−#define FF_CMP_ZERO 7
1959−#define FF_CMP_VSAD 8
1960−#define FF_CMP_VSSE 9
1961−#define FF_CMP_NSSE 10
1962−#define FF_CMP_W53 11
1963−#define FF_CMP_W97 12
1964−#define FF_CMP_DCTMAX 13
1965−#define FF_CMP_DCT264 14
1966−#define FF_CMP_CHROMA 256
1887+ int bidir_refine;
19671888
19681889 /**
1969− * ME diamond size & shape
1890+ *
19701891 * - encoding: Set by user.
19711892 * - decoding: unused
19721893 */
1973− int dia_size;
1894+ int brd_scale;
19741895
19751896 /**
1976− * amount of previous MV predictors (2a+1 x 2a+1 square)
1897+ * minimum GOP size
19771898 * - encoding: Set by user.
19781899 * - decoding: unused
19791900 */
1980− int last_predictor_count;
1901+ int keyint_min;
19811902
19821903 /**
1983− * prepass for motion estimation
1904+ * number of reference frames
1905+ * - encoding: Set by user.
1906+ * - decoding: Set by lavc.
1907+ */
1908+ int refs;
1909+
1910+ /**
1911+ * chroma qp offset from luma
19841912 * - encoding: Set by user.
19851913 * - decoding: unused
19861914 */
1987− int pre_me;
1915+ int chromaoffset;
19881916
19891917 /**
1990− * motion estimation prepass comparison function
1918+ * Multiplied by qscale for each frame and added to scene_change_score.
19911919 * - encoding: Set by user.
19921920 * - decoding: unused
19931921 */
1994− int me_pre_cmp;
1922+ int scenechange_factor;
19951923
19961924 /**
1997− * ME prepass diamond size & shape
1925+ *
1926+ * Note: Value depends upon the compare function used for fullpel ME.
19981927 * - encoding: Set by user.
19991928 * - decoding: unused
20001929 */
2001− int pre_dia_size;
1930+ int mv0_threshold;
20021931
20031932 /**
2004− * subpel ME quality
1933+ * Adjust sensitivity of b_frame_strategy 1.
20051934 * - encoding: Set by user.
20061935 * - decoding: unused
20071936 */
2008− int me_subpel_quality;
1937+ int b_sensitivity;
20091938
20101939 /**
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.
1940+ * Chromaticity coordinates of the source primaries.
1941+ * - encoding: Set by user
1942+ * - decoding: Set by libavcodec
20181943 */
2019− enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
1944+ enum AVColorPrimaries color_primaries;
20201945
20211946 /**
2022− * DTG active format information (additional aspect ratio
2023− * information only used in DVB MPEG-2 transport streams)
2024− * 0 if not set.
2025− *
2026− * - encoding: unused
2027− * - decoding: Set by decoder.
2028− */
2029− int dtg_active_format;
2030−#define FF_DTG_AFD_SAME 8
2031−#define FF_DTG_AFD_4_3 9
2032−#define FF_DTG_AFD_16_9 10
2033−#define FF_DTG_AFD_14_9 11
2034−#define FF_DTG_AFD_4_3_SP_14_9 13
2035−#define FF_DTG_AFD_16_9_SP_14_9 14
2036−#define FF_DTG_AFD_SP_4_3 15
2037−
2038− /**
2039− * maximum motion estimation search range in subpel units
2040− * If 0 then no limit.
2041− *
2042− * - encoding: Set by user.
2043− * - decoding: unused
1947+ * Color Transfer Characteristic.
1948+ * - encoding: Set by user
1949+ * - decoding: Set by libavcodec
20441950 */
2045− int me_range;
1951+ enum AVColorTransferCharacteristic color_trc;
20461952
20471953 /**
2048− * intra quantizer bias
2049− * - encoding: Set by user.
2050− * - decoding: unused
1954+ * YUV colorspace type.
1955+ * - encoding: Set by user
1956+ * - decoding: Set by libavcodec
20511957 */
2052− int intra_quant_bias;
2053−#define FF_DEFAULT_QUANT_BIAS 999999
1958+ enum AVColorSpace colorspace;
20541959
20551960 /**
2056− * inter quantizer bias
2057− * - encoding: Set by user.
2058− * - decoding: unused
1961+ * MPEG vs JPEG YUV range.
1962+ * - encoding: Set by user
1963+ * - decoding: Set by libavcodec
20591964 */
2060− int inter_quant_bias;
1965+ enum AVColorRange color_range;
20611966
20621967 /**
2063− * color table ID
2064− * - encoding: unused
2065− * - decoding: Which clrtable should be used for 8bit RGB images.
2066− * Tables have to be stored somewhere. FIXME
1968+ * This defines the location of chroma samples.
1969+ * - encoding: Set by user
1970+ * - decoding: Set by libavcodec
20671971 */
2068− int color_table_id;
1972+ enum AVChromaLocation chroma_sample_location;
20691973
20701974 /**
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.
1975+ * Number of slices.
1976+ * Indicates number of picture subdivisions. Used for parallelized
1977+ * decoding.
1978+ * - encoding: Set by user
20741979 * - decoding: unused
20751980 */
2076− int global_quality;
1981+ int slices;
20771982
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
1983+ /** Field order
1984+ * - encoding: set by libavcodec
1985+ * - decoding: Set by libavcodec
20871986 */
2088− int coder_type;
1987+ enum AVFieldOrder field_order;
1988+
1989+ /* audio only */
1990+ int sample_rate; ///< samples per second
1991+ int channels; ///< number of audio channels
20891992
20901993 /**
2091− * context model
1994+ * audio sample format
20921995 * - encoding: Set by user.
2093− * - decoding: unused
1996+ * - decoding: Set by libavcodec.
20941997 */
2095− int context_model;
1998+ enum AVSampleFormat sample_fmt; ///< sample format
20961999
2000+ /* The following data should not be initialized. */
20972001 /**
2098− * slice flags
2099− * - encoding: unused
2100− * - decoding: Set by user.
2002+ * Samples per packet, initialized when calling 'init'.
21012003 */
2102− int slice_flags;
2103−#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
2104−#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
2105−#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2004+ int frame_size;
2005+ int frame_number; ///< audio or video frame number
21062006
21072007 /**
2108− * XVideo Motion Acceleration
2109− * - encoding: forbidden
2110− * - decoding: set by decoder
2008+ * number of bytes per packet if constant and known or 0
2009+ * Used by some WAV based audio codecs.
21112010 */
2112− int xvmc_acceleration;
2011+ int block_align;
21132012
21142013 /**
2115− * macroblock decision mode
2014+ * Audio cutoff bandwidth (0 means "automatic")
21162015 * - encoding: Set by user.
21172016 * - decoding: unused
21182017 */
2119− int mb_decision;
2120−#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
2121−#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
2122−#define FF_MB_DECISION_RD 2 ///< rate distortion
2018+ int cutoff;
21232019
2020+#if FF_API_REQUEST_CHANNELS
21242021 /**
2125− * custom intra quantization matrix
2126− * - encoding: Set by user, can be NULL.
2127− * - decoding: Set by libavcodec.
2022+ * Decoder should decode to this many channels if it can (0 for default)
2023+ * - encoding: unused
2024+ * - decoding: Set by user.
2025+ * @deprecated Deprecated in favor of request_channel_layout.
21282026 */
2129− uint16_t *intra_matrix;
2027+ int request_channels;
2028+#endif
21302029
21312030 /**
2132− * custom inter quantization matrix
2133− * - encoding: Set by user, can be NULL.
2134− * - decoding: Set by libavcodec.
2031+ * Audio channel layout.
2032+ * - encoding: set by user.
2033+ * - decoding: set by user, may be overwritten by libavcodec.
21352034 */
2136− uint16_t *inter_matrix;
2035+ uint64_t channel_layout;
21372036
21382037 /**
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.
2038+ * Request decoder to use this channel layout if it can (0 for default)
21412039 * - encoding: unused
2142− * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2040+ * - decoding: Set by user.
21432041 */
2144− unsigned int stream_codec_tag;
2042+ uint64_t request_channel_layout;
21452043
21462044 /**
2147− * scene change detection threshold
2148− * 0 is default, larger means fewer detected scene changes.
2045+ * Type of service that the audio stream conveys.
21492046 * - encoding: Set by user.
2150− * - decoding: unused
2047+ * - decoding: Set by libavcodec.
21512048 */
2152− int scenechange_threshold;
2049+ enum AVAudioServiceType audio_service_type;
21532050
21542051 /**
2155− * minimum Lagrange multipler
2156− * - encoding: Set by user.
2157− * - decoding: unused
2052+ * desired sample format
2053+ * - encoding: Not used.
2054+ * - decoding: Set by user.
2055+ * Decoder will decode to this format if it can.
21582056 */
2159− int lmin;
2057+ enum AVSampleFormat request_sample_fmt;
21602058
21612059 /**
2162− * maximum Lagrange multipler
2163− * - encoding: Set by user.
2164− * - decoding: unused
2060+ * Called at the beginning of each frame to get a buffer for it.
2061+ *
2062+ * The function will set AVFrame.data[], AVFrame.linesize[].
2063+ * AVFrame.extended_data[] must also be set, but it should be the same as
2064+ * AVFrame.data[] except for planar audio with more channels than can fit
2065+ * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
2066+ * many data pointers as it can hold.
2067+ *
2068+ * if CODEC_CAP_DR1 is not set then get_buffer() must call
2069+ * avcodec_default_get_buffer() instead of providing buffers allocated by
2070+ * some other means.
2071+ *
2072+ * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
2073+ * need it. avcodec_default_get_buffer() aligns the output buffer properly,
2074+ * but if get_buffer() is overridden then alignment considerations should
2075+ * be taken into account.
2076+ *
2077+ * @see avcodec_default_get_buffer()
2078+ *
2079+ * Video:
2080+ *
2081+ * If pic.reference is set then the frame will be read later by libavcodec.
2082+ * avcodec_align_dimensions2() should be used to find the required width and
2083+ * height, as they normally need to be rounded up to the next multiple of 16.
2084+ *
2085+ * If frame multithreading is used and thread_safe_callbacks is set,
2086+ * it may be called from a different thread, but not from more than one at
2087+ * once. Does not need to be reentrant.
2088+ *
2089+ * @see release_buffer(), reget_buffer()
2090+ * @see avcodec_align_dimensions2()
2091+ *
2092+ * Audio:
2093+ *
2094+ * Decoders request a buffer of a particular size by setting
2095+ * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
2096+ * however, utilize only part of the buffer by setting AVFrame.nb_samples
2097+ * to a smaller value in the output frame.
2098+ *
2099+ * Decoders cannot use the buffer after returning from
2100+ * avcodec_decode_audio4(), so they will not call release_buffer(), as it
2101+ * is assumed to be released immediately upon return.
2102+ *
2103+ * As a convenience, av_samples_get_buffer_size() and
2104+ * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
2105+ * functions to find the required data size and to fill data pointers and
2106+ * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2107+ * since all planes must be the same size.
2108+ *
2109+ * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2110+ *
2111+ * - encoding: unused
2112+ * - decoding: Set by libavcodec, user can override.
21652113 */
2166− int lmax;
2114+ int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
21672115
21682116 /**
2169− * noise reduction strength
2170− * - encoding: Set by user.
2171− * - decoding: unused
2117+ * Called to release buffers which were allocated with get_buffer.
2118+ * A released buffer can be reused in get_buffer().
2119+ * pic.data[*] must be set to NULL.
2120+ * May be called from a different thread if frame multithreading is used,
2121+ * but not by more than one thread at once, so does not need to be reentrant.
2122+ * - encoding: unused
2123+ * - decoding: Set by libavcodec, user can override.
21722124 */
2173− int noise_reduction;
2125+ void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
21742126
21752127 /**
21762128 * Called at the beginning of a frame to get cr buffer for it.
@@ -2186,199 +2138,141 @@ typedef struct AVCodecContext { · 9 unmodified lines
21862138 */
21872139 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
21882140
2141+
2142+ /* - encoding parameters */
2143+ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
2144+ float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
2145+
21892146 /**
2190− * Number of bits which should be loaded into the rc buffer before decoding starts.
2147+ * minimum quantizer
21912148 * - encoding: Set by user.
21922149 * - decoding: unused
21932150 */
2194− int rc_initial_buffer_occupancy;
2151+ int qmin;
21952152
21962153 /**
2197− *
2154+ * maximum quantizer
21982155 * - encoding: Set by user.
21992156 * - decoding: unused
22002157 */
2201− int inter_threshold;
2158+ int qmax;
22022159
22032160 /**
2204− * CODEC_FLAG2_*
2161+ * maximum quantizer difference between frames
22052162 * - encoding: Set by user.
2206− * - decoding: Set by user.
2163+ * - decoding: unused
22072164 */
2208− int flags2;
2165+ int max_qdiff;
22092166
22102167 /**
2211− * Simulates errors in the bitstream to test error concealment.
2168+ * ratecontrol qmin qmax limiting method
2169+ * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
22122170 * - encoding: Set by user.
22132171 * - decoding: unused
22142172 */
2215− int error_rate;
2173+ float rc_qsquish;
2174+
2175+ float rc_qmod_amp;
2176+ int rc_qmod_freq;
22162177
22172178 /**
2218− * quantizer noise shaping
2179+ * decoder bitstream buffer size
22192180 * - encoding: Set by user.
22202181 * - decoding: unused
22212182 */
2222− int quantizer_noise_shaping;
2183+ int rc_buffer_size;
22232184
22242185 /**
2225− * thread count
2226− * is used to decide how many independent tasks should be passed to execute()
2227− * - encoding: Set by user.
2228− * - decoding: Set by user.
2229− */
2230− int thread_count;
2231−
2232− /**
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.
2186+ * ratecontrol override, see RcOverride
2187+ * - encoding: Allocated/set/freed by user.
2188+ * - decoding: unused
22402189 */
2241− int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
2190+ int rc_override_count;
2191+ RcOverride *rc_override;
22422192
22432193 /**
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()
2194+ * rate control equation
2195+ * - encoding: Set by user
2196+ * - decoding: unused
22482197 */
2249− void *thread_opaque;
2198+ const char *rc_eq;
22502199
22512200 /**
2252− * Motion estimation threshold below which no motion estimation is
2253− * performed, but instead the user specified motion vectors are used.
2254− *
2201+ * maximum bitrate
22552202 * - encoding: Set by user.
22562203 * - decoding: unused
22572204 */
2258− int me_threshold;
2205+ int rc_max_rate;
22592206
22602207 /**
2261− * Macroblock threshold below which the user specified macroblock types will be used.
2208+ * minimum bitrate
22622209 * - encoding: Set by user.
22632210 * - decoding: unused
22642211 */
2265− int mb_threshold;
2212+ int rc_min_rate;
2213+
2214+ float rc_buffer_aggressivity;
22662215
22672216 /**
2268− * precision of the intra DC coefficient - 8
2217+ * initial complexity for pass1 ratecontrol
22692218 * - encoding: Set by user.
22702219 * - decoding: unused
22712220 */
2272− int intra_dc_precision;
2221+ float rc_initial_cplx;
22732222
22742223 /**
2275− * noise vs. sse weight for the nsse comparsion function
2224+ * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
22762225 * - encoding: Set by user.
2277− * - decoding: unused
2226+ * - decoding: unused.
22782227 */
2279− int nsse_weight;
2228+ float rc_max_available_vbv_use;
22802229
22812230 /**
2282− * Number of macroblock rows at the top which are skipped.
2283− * - encoding: unused
2284− * - decoding: Set by user.
2231+ * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2232+ * - encoding: Set by user.
2233+ * - decoding: unused.
22852234 */
2286− int skip_top;
2235+ float rc_min_vbv_overflow_use;
22872236
22882237 /**
2289− * Number of macroblock rows at the bottom which are skipped.
2290− * - encoding: unused
2291− * - decoding: Set by user.
2238+ * Number of bits which should be loaded into the rc buffer before decoding starts.
2239+ * - encoding: Set by user.
2240+ * - decoding: unused
22922241 */
2293− int skip_bottom;
2242+ int rc_initial_buffer_occupancy;
22942243
2244+#define FF_CODER_TYPE_VLC 0
2245+#define FF_CODER_TYPE_AC 1
2246+#define FF_CODER_TYPE_RAW 2
2247+#define FF_CODER_TYPE_RLE 3
2248+#define FF_CODER_TYPE_DEFLATE 4
22952249 /**
2296− * profile
2250+ * coder type
22972251 * - encoding: Set by user.
2298− * - decoding: Set by libavcodec.
2252+ * - decoding: unused
22992253 */
2300− int profile;
2301−#define FF_PROFILE_UNKNOWN -99
2302−#define FF_PROFILE_RESERVED -100
2303−
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
2308−
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
2314−
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
2321−
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
2324−
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
2338−
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
2343−
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
2254+ int coder_type;
23602255
23612256 /**
2362− * level
2257+ * context model
23632258 * - encoding: Set by user.
2364− * - decoding: Set by libavcodec.
2259+ * - decoding: unused
23652260 */
2366− int level;
2367−#define FF_LEVEL_UNKNOWN -99
2261+ int context_model;
23682262
23692263 /**
2370− * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2371− * - encoding: unused
2372− * - decoding: Set by user.
2264+ * minimum Lagrange multipler
2265+ * - encoding: Set by user.
2266+ * - decoding: unused
23732267 */
2374− int lowres;
2268+ int lmin;
23752269
23762270 /**
2377− * Bitstream width / height, may be different from width/height if lowres enabled.
2378− * - encoding: unused
2379− * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
2271+ * maximum Lagrange multipler
2272+ * - encoding: Set by user.
2273+ * - decoding: unused
23802274 */
2381− int coded_width, coded_height;
2275+ int lmax;
23822276
23832277 /**
23842278 * frame skip threshold
@@ -2409,170 +2303,274 @@ typedef struct AVCodecContext { · 24 unmodified lines
24092303 int frame_skip_cmp;
24102304
24112305 /**
2412− * Border processing masking, raises the quantizer for mbs on the borders
2413− * of the picture.
2306+ * trellis RD quantization
24142307 * - encoding: Set by user.
24152308 * - decoding: unused
24162309 */
2417− float border_masking;
2310+ int trellis;
24182311
24192312 /**
2420− * minimum MB lagrange multipler
24212313 * - encoding: Set by user.
24222314 * - decoding: unused
24232315 */
2424− int mb_lmin;
2316+ int min_prediction_order;
24252317
24262318 /**
2427− * maximum MB lagrange multipler
24282319 * - encoding: Set by user.
24292320 * - decoding: unused
24302321 */
2431− int mb_lmax;
2322+ int max_prediction_order;
24322323
24332324 /**
2434− *
2435− * - encoding: Set by user.
2436− * - decoding: unused
2325+ * GOP timecode frame start number
2326+ * - encoding: Set by user, in non drop frame format
2327+ * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)
24372328 */
2438− int me_penalty_compensation;
2329+ int64_t timecode_frame_start;
24392330
2440− /**
2441− *
2442− * - encoding: unused
2443− * - decoding: Set by user.
2444− */
2445− enum AVDiscard skip_loop_filter;
2331+ /* The RTP callback: This function is called */
2332+ /* every time the encoder has a packet to send. */
2333+ /* It depends on the encoder if the data starts */
2334+ /* with a Start Code (it should). H.263 does. */
2335+ /* mb_nb contains the number of macroblocks */
2336+ /* encoded in the RTP payload. */
2337+ void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
24462338
2447− /**
2448− *
2449− * - encoding: unused
2450− * - decoding: Set by user.
2451− */
2452− enum AVDiscard skip_idct;
2339+ int rtp_payload_size; /* The size of the RTP payload: the coder will */
2340+ /* do its best to deliver a chunk with size */
2341+ /* below rtp_payload_size, the chunk will start */
2342+ /* with a start code on some codecs like H.263. */
2343+ /* This doesn't take account of any particular */
2344+ /* headers inside the transmitted RTP payload. */
24532345
2454− /**
2455− *
2456− * - encoding: unused
2457− * - decoding: Set by user.
2458− */
2459− enum AVDiscard skip_frame;
2346+ /* statistics, used for 2-pass encoding */
2347+ int mv_bits;
2348+ int header_bits;
2349+ int i_tex_bits;
2350+ int p_tex_bits;
2351+ int i_count;
2352+ int p_count;
2353+ int skip_count;
2354+ int misc_bits;
24602355
24612356 /**
2462− *
2463− * - encoding: Set by user.
2357+ * number of bits used for the previously encoded frame
2358+ * - encoding: Set by libavcodec.
24642359 * - decoding: unused
24652360 */
2466− int bidir_refine;
2361+ int frame_bits;
24672362
24682363 /**
2469− *
2470− * - encoding: Set by user.
2364+ * pass1 encoding statistics output buffer
2365+ * - encoding: Set by libavcodec.
24712366 * - decoding: unused
24722367 */
2473− int brd_scale;
2368+ char *stats_out;
24742369
24752370 /**
2476− * minimum GOP size
2477− * - encoding: Set by user.
2371+ * pass2 encoding statistics input buffer
2372+ * Concatenated stuff from stats_out of pass1 should be placed here.
2373+ * - encoding: Allocated/set/freed by user.
24782374 * - decoding: unused
24792375 */
2480− int keyint_min;
2376+ char *stats_in;
24812377
24822378 /**
2483− * number of reference frames
2484− * - encoding: Set by user.
2485− * - decoding: Set by lavc.
2379+ * Work around bugs in encoders which sometimes cannot be detected automatically.
2380+ * - encoding: Set by user
2381+ * - decoding: Set by user
24862382 */
2487− int refs;
2383+ int workaround_bugs;
2384+#define FF_BUG_AUTODETECT 1 ///< autodetection
2385+#define FF_BUG_OLD_MSMPEG4 2
2386+#define FF_BUG_XVID_ILACE 4
2387+#define FF_BUG_UMP4 8
2388+#define FF_BUG_NO_PADDING 16
2389+#define FF_BUG_AMV 32
2390+#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
2391+#define FF_BUG_QPEL_CHROMA 64
2392+#define FF_BUG_STD_QPEL 128
2393+#define FF_BUG_QPEL_CHROMA2 256
2394+#define FF_BUG_DIRECT_BLOCKSIZE 512
2395+#define FF_BUG_EDGE 1024
2396+#define FF_BUG_HPEL_CHROMA 2048
2397+#define FF_BUG_DC_CLIP 4096
2398+#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
2399+#define FF_BUG_TRUNCATED 16384
24882400
24892401 /**
2490− * chroma qp offset from luma
2402+ * strictly follow the standard (MPEG4, ...).
24912403 * - encoding: Set by user.
2492− * - decoding: unused
2404+ * - decoding: Set by user.
2405+ * Setting this to STRICT or higher means the encoder and decoder will
2406+ * generally do stupid things, whereas setting it to unofficial or lower
2407+ * will mean the encoder might produce output that is not supported by all
2408+ * spec-compliant decoders. Decoders don't differentiate between normal,
2409+ * unofficial and experimental (that is, they always try to decode things
2410+ * when they can) unless they are explicitly asked to behave stupidly
2411+ * (=strictly conform to the specs)
24932412 */
2494− int chromaoffset;
2413+ int strict_std_compliance;
2414+#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
2415+#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
2416+#define FF_COMPLIANCE_NORMAL 0
2417+#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
2418+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
24952419
24962420 /**
2497− * trellis RD quantization
2498− * - encoding: Set by user.
2499− * - decoding: unused
2421+ * error concealment flags
2422+ * - encoding: unused
2423+ * - decoding: Set by user.
25002424 */
2501− int trellis;
2425+ int error_concealment;
2426+#define FF_EC_GUESS_MVS 1
2427+#define FF_EC_DEBLOCK 2
25022428
25032429 /**
2504− * Audio cutoff bandwidth (0 means "automatic")
2430+ * debug
25052431 * - encoding: Set by user.
2506− * - decoding: unused
2432+ * - decoding: Set by user.
25072433 */
2508− int cutoff;
2434+ int debug;
2435+#define FF_DEBUG_PICT_INFO 1
2436+#define FF_DEBUG_RC 2
2437+#define FF_DEBUG_BITSTREAM 4
2438+#define FF_DEBUG_MB_TYPE 8
2439+#define FF_DEBUG_QP 16
2440+#define FF_DEBUG_MV 32
2441+#define FF_DEBUG_DCT_COEFF 0x00000040
2442+#define FF_DEBUG_SKIP 0x00000080
2443+#define FF_DEBUG_STARTCODE 0x00000100
2444+#define FF_DEBUG_PTS 0x00000200
2445+#define FF_DEBUG_ER 0x00000400
2446+#define FF_DEBUG_MMCO 0x00000800
2447+#define FF_DEBUG_BUGS 0x00001000
2448+#define FF_DEBUG_VIS_QP 0x00002000
2449+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
2450+#define FF_DEBUG_BUFFERS 0x00008000
2451+#define FF_DEBUG_THREADS 0x00010000
25092452
25102453 /**
2511− * Multiplied by qscale for each frame and added to scene_change_score.
2454+ * debug
25122455 * - encoding: Set by user.
2513− * - decoding: unused
2456+ * - decoding: Set by user.
25142457 */
2515− int scenechange_factor;
2458+ int debug_mv;
2459+#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
2460+#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
2461+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
25162462
25172463 /**
2518− *
2519− * Note: Value depends upon the compare function used for fullpel ME.
2520− * - encoding: Set by user.
2521− * - decoding: unused
2464+ * Error recognition; may misdetect some more or less valid parts as errors.
2465+ * - encoding: unused
2466+ * - decoding: Set by user.
25222467 */
2523− int mv0_threshold;
2468+ int err_recognition;
2469+#define AV_EF_CRCCHECK (1<<0)
2470+#define AV_EF_BITSTREAM (1<<1)
2471+#define AV_EF_BUFFER (1<<2)
2472+#define AV_EF_EXPLODE (1<<3)
2473+
2474+#define AV_EF_CAREFUL (1<<16)
2475+#define AV_EF_COMPLIANT (1<<17)
2476+#define AV_EF_AGGRESSIVE (1<<18)
2477+
25242478
25252479 /**
2526− * Adjust sensitivity of b_frame_strategy 1.
2527− * - encoding: Set by user.
2528− * - decoding: unused
2480+ * opaque 64bit number (generally a PTS) that will be reordered and
2481+ * output in AVFrame.reordered_opaque
2482+ * @deprecated in favor of pkt_pts
2483+ * - encoding: unused
2484+ * - decoding: Set by user.
25292485 */
2530− int b_sensitivity;
2486+ int64_t reordered_opaque;
25312487
25322488 /**
2533− * - encoding: Set by user.
2534− * - decoding: unused
2489+ * Hardware accelerator in use
2490+ * - encoding: unused.
2491+ * - decoding: Set by libavcodec
25352492 */
2536− int compression_level;
2537−#define FF_COMPRESSION_DEFAULT -1
2493+ struct AVHWAccel *hwaccel;
25382494
25392495 /**
2540− * - encoding: Set by user.
2496+ * Hardware accelerator context.
2497+ * For some hardware accelerators, a global context needs to be
2498+ * provided by the user. In that case, this holds display-dependent
2499+ * data FFmpeg cannot instantiate itself. Please refer to the
2500+ * FFmpeg HW accelerator documentation to know how to fill this
2501+ * is. e.g. for VA API, this is a struct vaapi_context.
2502+ * - encoding: unused
2503+ * - decoding: Set by user
2504+ */
2505+ void *hwaccel_context;
2506+
2507+ /**
2508+ * error
2509+ * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
25412510 * - decoding: unused
25422511 */
2543− int min_prediction_order;
2512+ uint64_t error[AV_NUM_DATA_POINTERS];
25442513
25452514 /**
2515+ * DCT algorithm, see FF_DCT_* below
25462516 * - encoding: Set by user.
25472517 * - decoding: unused
25482518 */
2549− int max_prediction_order;
2519+ int dct_algo;
2520+#define FF_DCT_AUTO 0
2521+#define FF_DCT_FASTINT 1
2522+#define FF_DCT_INT 2
2523+#define FF_DCT_MMX 3
2524+#define FF_DCT_ALTIVEC 5
2525+#define FF_DCT_FAAN 6
25502526
25512527 /**
2552− * GOP timecode frame start number
2553− * - encoding: Set by user, in non drop frame format
2554− * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)
2528+ * IDCT algorithm, see FF_IDCT_* below.
2529+ * - encoding: Set by user.
2530+ * - decoding: Set by user.
25552531 */
2556− int64_t timecode_frame_start;
2532+ int idct_algo;
2533+#define FF_IDCT_AUTO 0
2534+#define FF_IDCT_INT 1
2535+#define FF_IDCT_SIMPLE 2
2536+#define FF_IDCT_SIMPLEMMX 3
2537+#define FF_IDCT_LIBMPEG2MMX 4
2538+#define FF_IDCT_MMI 5
2539+#define FF_IDCT_ARM 7
2540+#define FF_IDCT_ALTIVEC 8
2541+#define FF_IDCT_SH4 9
2542+#define FF_IDCT_SIMPLEARM 10
2543+#define FF_IDCT_H264 11
2544+#define FF_IDCT_VP3 12
2545+#define FF_IDCT_IPP 13
2546+#define FF_IDCT_XVIDMMX 14
2547+#define FF_IDCT_CAVS 15
2548+#define FF_IDCT_SIMPLEARMV5TE 16
2549+#define FF_IDCT_SIMPLEARMV6 17
2550+#define FF_IDCT_SIMPLEVIS 18
2551+#define FF_IDCT_WMV2 19
2552+#define FF_IDCT_FAAN 20
2553+#define FF_IDCT_EA 21
2554+#define FF_IDCT_SIMPLENEON 22
2555+#define FF_IDCT_SIMPLEALPHA 23
2556+#define FF_IDCT_BINK 24
25572557
2558−#if FF_API_REQUEST_CHANNELS
25592558 /**
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.
2559+ * dsp_mask could be add used to disable unwanted CPU features
2560+ * CPU features (i.e. MMX, SSE. ...)
2561+ *
2562+ * With the FORCE flag you may instead enable given CPU features.
2563+ * (Dangerous: Usable in case of misdetection, improper usage however will
2564+ * result into program crash.)
25642565 */
2565− int request_channels;
2566−#endif
2566+ unsigned dsp_mask;
25672567
25682568 /**
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
2569+ * bits per sample/pixel from the demuxer (needed for huffyuv).
2570+ * - encoding: Set by libavcodec.
25732571 * - decoding: Set by user.
25742572 */
2575− int64_t reordered_opaque;
2573+ int bits_per_coded_sample;
25762574
25772575 /**
25782576 * Bits per sample/pixel of internal libavcodec pixel/sample format.
@@ -2582,95 +2580,66 @@ typedef struct AVCodecContext { · 3 unmodified lines
25822580 int bits_per_raw_sample;
25832581
25842582 /**
2585− * Audio channel layout.
2586− * - encoding: set by user.
2587− * - decoding: set by user, may be overwritten by libavcodec.
2588− */
2589− uint64_t channel_layout;
2590−
2591− /**
2592− * Request decoder to use this channel layout if it can (0 for default)
2583+ * low resolution decoding, 1-> 1/2 size, 2->1/4 size
25932584 * - encoding: unused
25942585 * - decoding: Set by user.
25952586 */
2596− uint64_t request_channel_layout;
2587+ int lowres;
25972588
25982589 /**
2599− * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2600− * - encoding: Set by user.
2601− * - decoding: unused.
2590+ * the picture in the bitstream
2591+ * - encoding: Set by libavcodec.
2592+ * - decoding: Set by libavcodec.
26022593 */
2603− float rc_max_available_vbv_use;
2594+ AVFrame *coded_frame;
26042595
26052596 /**
2606− * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2597+ * thread count
2598+ * is used to decide how many independent tasks should be passed to execute()
26072599 * - encoding: Set by user.
2608− * - decoding: unused.
2609− */
2610− float rc_min_vbv_overflow_use;
2611−
2612− /**
2613− * Hardware accelerator in use
2614− * - encoding: unused.
2615− * - decoding: Set by libavcodec
2600+ * - decoding: Set by user.
26162601 */
2617− struct AVHWAccel *hwaccel;
2602+ int thread_count;
26182603
26192604 /**
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 ...
2605+ * Which multithreading methods to use.
2606+ * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2607+ * so clients which cannot provide future frames should not use it.
26232608 *
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− * Hardware accelerator context.
2630− * For some hardware accelerators, a global context needs to be
2631− * provided by the user. In that case, this holds display-dependent
2632− * data FFmpeg cannot instantiate itself. Please refer to the
2633− * FFmpeg HW accelerator documentation to know how to fill this
2634− * is. e.g. for VA API, this is a struct vaapi_context.
2635− * - encoding: unused
2636− * - decoding: Set by user
2637− */
2638− void *hwaccel_context;
2639−
2640− /**
2641− * Chromaticity coordinates of the source primaries.
2642− * - encoding: Set by user
2643− * - decoding: Set by libavcodec
2644− */
2645− enum AVColorPrimaries color_primaries;
2646−
2647− /**
2648− * Color Transfer Characteristic.
2649− * - encoding: Set by user
2650− * - decoding: Set by libavcodec
2609+ * - encoding: Set by user, otherwise the default is used.
2610+ * - decoding: Set by user, otherwise the default is used.
26512611 */
2652− enum AVColorTransferCharacteristic color_trc;
2612+ int thread_type;
2613+#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
2614+#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
26532615
26542616 /**
2655− * YUV colorspace type.
2656− * - encoding: Set by user
2657− * - decoding: Set by libavcodec
2617+ * Which multithreading methods are in use by the codec.
2618+ * - encoding: Set by libavcodec.
2619+ * - decoding: Set by libavcodec.
26582620 */
2659− enum AVColorSpace colorspace;
2621+ int active_thread_type;
26602622
26612623 /**
2662− * MPEG vs JPEG YUV range.
2663− * - encoding: Set by user
2664− * - decoding: Set by libavcodec
2624+ * Set by the client if its custom get_buffer() callback can be called
2625+ * from another thread, which allows faster multithreaded decoding.
2626+ * draw_horiz_band() will be called from other threads regardless of this setting.
2627+ * Ignored if the default get_buffer() is used.
2628+ * - encoding: Set by user.
2629+ * - decoding: Set by user.
26652630 */
2666− enum AVColorRange color_range;
2631+ int thread_safe_callbacks;
26672632
26682633 /**
2669− * This defines the location of chroma samples.
2670− * - encoding: Set by user
2671− * - decoding: Set by libavcodec
2634+ * The codec may call this to execute several independent things.
2635+ * It will return only after finishing all tasks.
2636+ * The user may replace this with some multithreaded implementation,
2637+ * the default implementation will execute the parts serially.
2638+ * @param count the number of things to execute
2639+ * - encoding: Set by libavcodec, user can override.
2640+ * - decoding: Set by libavcodec, user can override.
26722641 */
2673− enum AVChromaLocation chroma_sample_location;
2642+ int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
26742643
26752644 /**
26762645 * The codec may call this to execute several independent things.
@@ -2692,117 +2661,150 @@ typedef struct AVCodecContext { · 15 unmodified lines
26922661 */
26932662 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
26942663
2695− int log_level_offset;
2664+ /**
2665+ * thread opaque
2666+ * Can be used by execute() to store some per AVCodecContext stuff.
2667+ * - encoding: set by execute()
2668+ * - decoding: set by execute()
2669+ */
2670+ void *thread_opaque;
26962671
26972672 /**
2698− * Number of slices.
2699− * Indicates number of picture subdivisions. Used for parallelized
2700− * decoding.
2701− * - encoding: Set by user
2673+ * noise vs. sse weight for the nsse comparsion function
2674+ * - encoding: Set by user.
27022675 * - decoding: unused
27032676 */
2704− int slices;
2677+ int nsse_weight;
27052678
27062679 /**
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())
2680+ * profile
2681+ * - encoding: Set by user.
2682+ * - decoding: Set by libavcodec.
27132683 */
2714− uint8_t *subtitle_header;
2715− int subtitle_header_size;
2684+ int profile;
2685+#define FF_PROFILE_UNKNOWN -99
2686+#define FF_PROFILE_RESERVED -100
2687+
2688+#define FF_PROFILE_AAC_MAIN 0
2689+#define FF_PROFILE_AAC_LOW 1
2690+#define FF_PROFILE_AAC_SSR 2
2691+#define FF_PROFILE_AAC_LTP 3
2692+
2693+#define FF_PROFILE_DTS 20
2694+#define FF_PROFILE_DTS_ES 30
2695+#define FF_PROFILE_DTS_96_24 40
2696+#define FF_PROFILE_DTS_HD_HRA 50
2697+#define FF_PROFILE_DTS_HD_MA 60
2698+
2699+#define FF_PROFILE_MPEG2_422 0
2700+#define FF_PROFILE_MPEG2_HIGH 1
2701+#define FF_PROFILE_MPEG2_SS 2
2702+#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
2703+#define FF_PROFILE_MPEG2_MAIN 4
2704+#define FF_PROFILE_MPEG2_SIMPLE 5
2705+
2706+#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
2707+#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
2708+
2709+#define FF_PROFILE_H264_BASELINE 66
2710+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2711+#define FF_PROFILE_H264_MAIN 77
2712+#define FF_PROFILE_H264_EXTENDED 88
2713+#define FF_PROFILE_H264_HIGH 100
2714+#define FF_PROFILE_H264_HIGH_10 110
2715+#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
2716+#define FF_PROFILE_H264_HIGH_422 122
2717+#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
2718+#define FF_PROFILE_H264_HIGH_444 144
2719+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
2720+#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
2721+#define FF_PROFILE_H264_CAVLC_444 44
2722+
2723+#define FF_PROFILE_VC1_SIMPLE 0
2724+#define FF_PROFILE_VC1_MAIN 1
2725+#define FF_PROFILE_VC1_COMPLEX 2
2726+#define FF_PROFILE_VC1_ADVANCED 3
2727+
2728+#define FF_PROFILE_MPEG4_SIMPLE 0
2729+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
2730+#define FF_PROFILE_MPEG4_CORE 2
2731+#define FF_PROFILE_MPEG4_MAIN 3
2732+#define FF_PROFILE_MPEG4_N_BIT 4
2733+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
2734+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
2735+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
2736+#define FF_PROFILE_MPEG4_HYBRID 8
2737+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
2738+#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
2739+#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
2740+#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
2741+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2742+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
2743+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
27162744
27172745 /**
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
2746+ * level
2747+ * - encoding: Set by user.
2748+ * - decoding: Set by libavcodec.
27232749 */
2724− AVPacket *pkt;
2750+ int level;
2751+#define FF_LEVEL_UNKNOWN -99
27252752
27262753 /**
2727− * Which multithreading methods to use.
2728− * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2729− * so clients which cannot provide future frames should not use it.
27302754 *
2731− * - encoding: Set by user, otherwise the default is used.
2732− * - decoding: Set by user, otherwise the default is used.
2755+ * - encoding: unused
2756+ * - decoding: Set by user.
27332757 */
2734− int thread_type;
2735−#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
2736−#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
2758+ enum AVDiscard skip_loop_filter;
27372759
27382760 /**
2739− * Which multithreading methods are in use by the codec.
2740− * - encoding: Set by libavcodec.
2741− * - decoding: Set by libavcodec.
2761+ *
2762+ * - encoding: unused
2763+ * - decoding: Set by user.
27422764 */
2743− int active_thread_type;
2765+ enum AVDiscard skip_idct;
27442766
27452767 /**
2746− * Set by the client if its custom get_buffer() callback can be called
2747− * from another thread, which allows faster multithreaded decoding.
2748− * draw_horiz_band() will be called from other threads regardless of this setting.
2749− * Ignored if the default get_buffer() is used.
2750− * - encoding: Set by user.
2768+ *
2769+ * - encoding: unused
27512770 * - decoding: Set by user.
27522771 */
2753− int thread_safe_callbacks;
2772+ enum AVDiscard skip_frame;
27542773
27552774 /**
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.
2775+ * Header containing style information for text subtitles.
2776+ * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
2777+ * [Script Info] and [V4+ Styles] section, plus the [Events] line and
2778+ * the Format line following. It shouldn't include any Dialogue line.
2779+ * - encoding: Set/allocated/freed by user (before avcodec_open2())
2780+ * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
27602781 */
2761− uint64_t vbv_delay;
2782+ uint8_t *subtitle_header;
2783+ int subtitle_header_size;
27622784
27632785 /**
2764− * Type of service that the audio stream conveys.
2786+ * Simulates errors in the bitstream to test error concealment.
27652787 * - encoding: Set by user.
2766− * - decoding: Set by libavcodec.
2767− */
2768− enum AVAudioServiceType audio_service_type;
2769−
2770− /**
2771− * desired sample format
2772− * - encoding: Not used.
2773− * - decoding: Set by user.
2774− * Decoder will decode to this format if it can.
2788+ * - decoding: unused
27752789 */
2776− enum AVSampleFormat request_sample_fmt;
2790+ int error_rate;
27772791
27782792 /**
2779− * Error recognition; may misdetect some more or less valid parts as errors.
2793+ * Current packet as passed into the decoder, to avoid having
2794+ * to pass the packet into every function. Currently only valid
2795+ * inside lavc and get/release_buffer callbacks.
2796+ * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
27802797 * - encoding: unused
2781− * - decoding: Set by user.
27822798 */
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)
2788−
2789−#define AV_EF_CAREFUL (1<<16)
2790−#define AV_EF_COMPLIANT (1<<17)
2791−#define AV_EF_AGGRESSIVE (1<<18)
2799+ AVPacket *pkt;
27922800
27932801 /**
2794− * Private context used for internal data.
2795− *
2796− * Unlike priv_data, this is not codec-specific. It is used in general
2797− * libavcodec functions.
2798− */
2799− struct AVCodecInternal *internal;
2800−
2801− /** Field order
2802− * - encoding: set by libavcodec
2803− * - decoding: Set by libavcodec
2802+ * VBV delay coded in the last frame (in periods of a 27 MHz clock).
2803+ * Used for compliant TS muxing.
2804+ * - encoding: Set by libavcodec.
2805+ * - decoding: unused.
28042806 */
2805− enum AVFieldOrder field_order;
2807+ uint64_t vbv_delay;
28062808
28072809 /**
28082810 * Current statistics for PTS correction.
@@ -2813,7 +2815,6 @@ typedef struct AVCodecContext { · 4 unmodified lines
28132815 int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
28142816 int64_t pts_correction_last_pts; /// PTS of the last frame
28152817 int64_t pts_correction_last_dts; /// DTS of the last frame
2816−
28172818 } AVCodecContext;
28182819
28192820 /**
libavcodec/pthread.c+1−1
@@ -480,7 +480,7 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src) · 479 unmodified lines
480480 dst->slice_flags = src->slice_flags;
481481 dst->flags2 = src->flags2;
482482
483− copy_fields(skip_loop_filter, bidir_refine);
483+ copy_fields(skip_loop_filter, subtitle_header);
484484
485485 dst->frame_number = src->frame_number;
486486 dst->reordered_opaque = src->reordered_opaque;
libavcodec/utils.c+1−1
@@ -603,7 +603,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ · 602 unmodified lines
603603 return s->get_buffer(s, pic);
604604 }
605605
606− assert(s->pix_fmt == pic->pix_fmt);
606+ assert(s->pix_fmt == pic->format);
607607
608608 /* If internal buffer type return the same buffer */
609609 if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
libavcodec/x86/h264_deblock_10bit.asm+1−1
@@ -876,7 +876,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16) · 875 unmodified lines
876876 %if mmsize < 16
877877 add r0, mmsize
878878 add r5, mmsize
879− add r4, mmsize/8
879+ add r4, mmsize/4
880880 dec r6
881881 jg .loop
882882 REP_RET
libavformat/flvdec.c+50−10
@@ -35,12 +35,20 @@ · 34 unmodified lines
3535 #include "avio_internal.h"
3636 #include "flv.h"
3737
38+#define VALIDATE_INDEX_TS_THRESH 2500
39+
3840 typedef struct {
3941 int wrong_dts; ///< wrong dts due to negative cts
4042 uint8_t *new_extradata[FLV_STREAM_TYPE_NB];
4143 int new_extradata_size[FLV_STREAM_TYPE_NB];
4244 int last_sample_rate;
4345 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;
4452 } FLVContext;
4553
4654 static int flv_probe(AVProbeData *p)
@@ -137,6 +145,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { · 90 unmodified lines
137145 }
138146
139147 static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
148+ FLVContext *flv = s->priv_data;
140149 unsigned int timeslen = 0, fileposlen = 0, i;
141150 char str_val[256];
142151 int64_t *times = NULL;
@@ -192,18 +201,15 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream · 49 unmodified lines
192201 }
193202
194203 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++)
204+ for (i = 0; i < fileposlen; i++) {
205205 av_add_index_entry(vstream, filepositions[i], times[i]*1000,
206206 0, 0, AVINDEX_KEYFRAME);
207+ if (i < 2) {
208+ flv->validate_index[i].pos = filepositions[i];
209+ flv->validate_index[i].dts = times[i] * 1000;
210+ flv->validate_count = i + 1;
211+ }
212+ }
207213 } else {
208214 invalid:
209215 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, · 234 unmodified lines
444450 return 0;
445451 }
446452
453+static void clear_index_entries(AVFormatContext *s, int64_t pos)
454+{
455+ int i, j, out;
456+ av_log(s, AV_LOG_WARNING, "Found invalid index entries, clearing the index.\n");
457+ for (i = 0; i < s->nb_streams; i++) {
458+ AVStream *st = s->streams[i];
459+ /* Remove all index entries that point to >= pos */
460+ out = 0;
461+ for (j = 0; j < st->nb_index_entries; j++) {
462+ if (st->index_entries[j].pos < pos)
463+ st->index_entries[out++] = st->index_entries[j];
464+ }
465+ st->nb_index_entries = out;
466+ }
467+}
468+
447469 static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
448470 {
449471 FLVContext *flv = s->priv_data;
@@ -467,6 +489,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 17 unmodified lines
467489 avio_skip(s->pb, 3); /* stream id, always 0 */
468490 flags = 0;
469491
492+ if (flv->validate_next < flv->validate_count) {
493+ int64_t validate_pos = flv->validate_index[flv->validate_next].pos;
494+ if (pos == validate_pos) {
495+ if (FFABS(dts - flv->validate_index[flv->validate_next].dts) <=
496+ VALIDATE_INDEX_TS_THRESH) {
497+ flv->validate_next++;
498+ } else {
499+ clear_index_entries(s, validate_pos);
500+ flv->validate_count = 0;
501+ }
502+ } else if (pos > validate_pos) {
503+ clear_index_entries(s, validate_pos);
504+ flv->validate_count = 0;
505+ }
506+ }
507+
470508 if(size == 0)
471509 continue;
472510
@@ -654,6 +692,8 @@ leave: · 181 unmodified lines
654692 static int flv_read_seek(AVFormatContext *s, int stream_index,
655693 int64_t ts, int flags)
656694 {
695+ FLVContext *flv = s->priv_data;
696+ flv->validate_count = 0;
657697 return avio_seek_time(s->pb, stream_index, ts, flags);
658698 }
659699
libavformat/movenc.c+41−13
@@ -565,6 +565,42 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) · 564 unmodified lines
565565 }
566566 }
567567
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+
568604 static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
569605 {
570606 int64_t pos = avio_tell(pb);
@@ -607,7 +643,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) · 36 unmodified lines
607643 avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
608644 avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));
609645 avio_wb32(pb, track->sample_size);
610− avio_wb32(pb, track->enc->frame_size);
646+ avio_wb32(pb, get_samples_per_packet(track));
611647 } else {
612648 if (track->mode == MODE_MOV) {
613649 avio_wb16(pb, track->enc->channels);
@@ -1143,9 +1179,7 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) · 529 unmodified lines
11431179 av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */
11441180 NULL;
11451181 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;
1182+ int duration = get_cluster_duration(track, i);
11491183 if (i && duration == stts_entries[entries].duration) {
11501184 stts_entries[entries].count++; /* compress */
11511185 } else {
@@ -2262,7 +2296,7 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track, · 1110 unmodified lines
22622296 if (flags & MOV_TFHD_BASE_DATA_OFFSET)
22632297 avio_wb64(pb, moof_offset);
22642298 if (flags & MOV_TFHD_DEFAULT_DURATION) {
2265− track->default_duration = track->audio_vbr ? track->enc->frame_size : 1;
2299+ track->default_duration = get_cluster_duration(track, 0);
22662300 avio_wb32(pb, track->default_duration);
22672301 }
22682302 if (flags & MOV_TFHD_DEFAULT_SIZE) {
@@ -2295,10 +2329,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track) · 26 unmodified lines
22952329 int i;
22962330
22972331 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)
2332+ if (get_cluster_duration(track, i) != track->default_duration)
23022333 flags |= MOV_TRUN_SAMPLE_DURATION;
23032334 if (track->cluster[i].size != track->default_size)
23042335 flags |= MOV_TRUN_SAMPLE_SIZE;
@@ -2322,11 +2353,8 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track) · 17 unmodified lines
23222353 avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
23232354
23242355 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;
23282356 if (flags & MOV_TRUN_SAMPLE_DURATION)
2329− avio_wb32(pb, duration);
2357+ avio_wb32(pb, get_cluster_duration(track, i));
23302358 if (flags & MOV_TRUN_SAMPLE_SIZE)
23312359 avio_wb32(pb, track->cluster[i].size);
23322360 if (flags & MOV_TRUN_SAMPLE_FLAGS)
libavformat/rtsp.c+53−5
@@ -900,9 +900,13 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 899 unmodified lines
900900 char buf[4096], buf1[1024], *q;
901901 unsigned char ch;
902902 const char *p;
903− int ret, content_length, line_count = 0;
903+ int ret, content_length, line_count = 0, request = 0;
904904 unsigned char *content = NULL;
905905
906+start:
907+ line_count = 0;
908+ request = 0;
909+ content = NULL;
906910 memset(reply, 0, sizeof(*reply));
907911
908912 /* parse reply (XXX: use buffers) */
@@ -938,9 +942,15 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 29 unmodified lines
938942 if (line_count == 0) {
939943 /* get reply code */
940944 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));
945+ if (!strncmp(buf1, "RTSP/", 5)) {
946+ get_word(buf1, sizeof(buf1), &p);
947+ reply->status_code = atoi(buf1);
948+ av_strlcpy(reply->reason, p, sizeof(reply->reason));
949+ } else {
950+ av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method
951+ get_word(buf1, sizeof(buf1), &p); // object
952+ request = 1;
953+ }
944954 } else {
945955 ff_rtsp_parse_line(reply, p, rt, method);
946956 av_strlcat(rt->last_reply, p, sizeof(rt->last_reply));
@@ -949,7 +959,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 2 unmodified lines
949959 line_count++;
950960 }
951961
952− if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0')
962+ if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0' && !request)
953963 av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));
954964
955965 content_length = reply->content_length;
@@ -964,6 +974,44 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 8 unmodified lines
964974 else
965975 av_free(content);
966976
977+ if (request) {
978+ char buf[1024];
979+ char base64buf[AV_BASE64_SIZE(sizeof(buf))];
980+ const char* ptr = buf;
981+
982+ if (!strcmp(reply->reason, "OPTIONS")) {
983+ snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");
984+ if (reply->seq)
985+ av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);
986+ if (reply->session_id[0])
987+ av_strlcatf(buf, sizeof(buf), "Session: %s\r\n",
988+ reply->session_id);
989+ } else {
990+ snprintf(buf, sizeof(buf), "RTSP/1.0 501 Not Implemented\r\n");
991+ }
992+ av_strlcat(buf, "\r\n", sizeof(buf));
993+
994+ if (rt->control_transport == RTSP_MODE_TUNNEL) {
995+ av_base64_encode(base64buf, sizeof(base64buf), buf, strlen(buf));
996+ ptr = base64buf;
997+ }
998+ ffurl_write(rt->rtsp_hd_out, ptr, strlen(ptr));
999+
1000+ rt->last_cmd_time = av_gettime();
1001+ /* Even if the request from the server had data, it is not the data
1002+ * that the caller wants or expects. The memory could also be leaked
1003+ * if the actual following reply has content data. */
1004+ if (content_ptr)
1005+ av_freep(content_ptr);
1006+ /* If method is set, this is called from ff_rtsp_send_cmd,
1007+ * where a reply to exactly this request is awaited. For
1008+ * callers from within packet reciving, we just want to
1009+ * return to the caller and go back to receiving packets. */
1010+ if (method)
1011+ goto start;
1012+ return 0;
1013+ }
1014+
9671015 if (rt->seq != reply->seq) {
9681016 av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",
9691017 rt->seq, reply->seq);
tests/fate/lossless-audio.mak+1−0
@@ -15,3 +15,4 @@ fate-lossless-tta: CMD = crc -i $(SAMPLES)/lossless-audio/inside.tta · 14 unmodified lines
1515
1616 FATE_TESTS += $(FATE_LOSSLESS_AUDIO)
1717 fate-lossless-audio: $(FATE_LOSSLESS_AUDIO)
18+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t