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
352012-01-24 - xxxxxxx - lavfi 2.60.100352012-01-24 - xxxxxxx - lavfi 2.60.100
36 Add avfilter_graph_dump.36 Add avfilter_graph_dump.
37 37
382012-xx-xx - xxxxxxx - lavu 51.24.0 - error.h382012-02-25 - c9bca80 - lavu 51.24.0 - error.h
39 Add AVERROR_UNKNOWN39 Add AVERROR_UNKNOWN
40 40
412012-xx-xx - xxxxxxx - lavc 54.x.x412012-02-20 - e9cda85 - lavc 54.2.0
42 Add duration field to AVCodecParserContext42 Add duration field to AVCodecParserContext
43 43
442012-02-xx - xxxxxxx - lavu 51.23.1 - mathematics.h442012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h
45 Add av_rescale_q_rnd()45 Add av_rescale_q_rnd()
46 46
472012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h472012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h
48 Add PIX_FMT_PSEUDOPAL flag.48 Add PIX_FMT_PSEUDOPAL flag.
49 49
502012-02-01 - xxxxxxx - lavc 54.01.0502012-02-08 - 52f82a1 - lavc 54.01.0
51 Add avcodec_encode_video2() and deprecate avcodec_encode_video().51 Add avcodec_encode_video2() and deprecate avcodec_encode_video().
52 52
532012-02-01 - 316fc74 - lavc 54.01.0532012-02-01 - 316fc74 - lavc 54.01.0
libavcodec/avcodec.h+1009−1008
@@ -891,12 +891,48 @@ typedef struct AVFrame { · 890 unmodified lines
891 int linesize[AV_NUM_DATA_POINTERS];891 int linesize[AV_NUM_DATA_POINTERS];
892 892
893 /**893 /**
894 * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.894 * pointers to the data planes/channels.
895 * This isn't used by libavcodec unless the default get/release_buffer() is used.895 *
896 * - encoding:896 * For video, this should simply point to data[].
897 * - decoding:897 *
898 * For planar audio, each channel has a separate data pointer, and
899 * linesize[0] contains the size of each channel buffer.
900 * For packed audio, there is just one data pointer, and linesize[0]
901 * contains the total size of the buffer for all channels.
902 *
903 * Note: Both data and extended_data will always be set by get_buffer(),
904 * but for planar audio with more channels that can fit in data,
905 * extended_data must be used by the decoder in order to access all
906 * channels.
907 *
908 * encoding: unused
909 * decoding: set by AVCodecContext.get_buffer()
898 */910 */
899 uint8_t *base[AV_NUM_DATA_POINTERS];911 uint8_t **extended_data;
912
913 /**
914 * width and height of the video frame
915 * - encoding: unused
916 * - decoding: Read by user.
917 */
918 int width, height;
919
920 /**
921 * number of audio samples (per channel) described by this frame
922 * - encoding: Set by user
923 * - decoding: Set by libavcodec
924 */
925 int nb_samples;
926
927 /**
928 * format of the frame, -1 if unknown or unset
929 * Values correspond to enum PixelFormat for video frames,
930 * enum AVSampleFormat for audio)
931 * - encoding: unused
932 * - decoding: Read by user.
933 */
934 int format;
935
900 /**936 /**
901 * 1 -> keyframe, 0-> not937 * 1 -> keyframe, 0-> not
902 * - encoding: Set by libavcodec.938 * - encoding: Set by libavcodec.
@@ -911,6 +947,21 @@ typedef struct AVFrame { · 8 unmodified lines
911 */947 */
912 enum AVPictureType pict_type;948 enum AVPictureType pict_type;
913 949
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
914 /**965 /**
915 * presentation timestamp in time_base units (time when frame should be shown to user)966 * presentation timestamp in time_base units (time when frame should be shown to user)
916 * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.967 * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
@@ -919,6 +970,20 @@ typedef struct AVFrame { · 2 unmodified lines
919 */970 */
920 int64_t pts;971 int64_t pts;
921 972
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
922 /**987 /**
923 * picture number in bitstream order988 * picture number in bitstream order
924 * - encoding: set by989 * - encoding: set by
@@ -962,6 +1027,11 @@ typedef struct AVFrame { · 37 unmodified lines
962 */1027 */
963 int qstride;1028 int qstride;
964 1029
1030 /**
1031 *
1032 */
1033 int qscale_type;
1034
965 /**1035 /**
966 * mbskip_table[mb]>=1 if MB didn't change1036 * mbskip_table[mb]>=1 if MB didn't change
967 * stride= mb_width = (width+15)>>41037 * stride= mb_width = (width+15)>>4
@@ -993,12 +1063,19 @@ typedef struct AVFrame { · 25 unmodified lines
993 uint32_t *mb_type;1063 uint32_t *mb_type;
994 1064
995 /**1065 /**
996 * log2 of the size of the block which a single vector in motion_val represents:1066 * DCT coefficients
997 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
998 * - encoding: unused1067 * - encoding: unused
999 * - decoding: Set by libavcodec.1068 * - decoding: Set by libavcodec.
1000 */1069 */
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];
1002 1079
1003 /**1080 /**
1004 * for some private data of the user1081 * for some private data of the user
@@ -1030,11 +1107,6 @@ typedef struct AVFrame { · 25 unmodified lines
1030 */1107 */
1031 int repeat_pict;1108 int repeat_pict;
1032 1109
1033 /**
1034 *
1035 */
1036 int qscale_type;
1037
1038 /**1110 /**
1039 * The content of the picture is interlaced.1111 * The content of the picture is interlaced.
1040 * - encoding: Set by user.1112 * - encoding: Set by user.
@@ -1049,13 +1121,6 @@ typedef struct AVFrame { · 8 unmodified lines
1049 */1121 */
1050 int top_field_first;1122 int top_field_first;
1051 1123
1052 /**
1053 * Pan scan.
1054 * - encoding: Set by user.
1055 * - decoding: Set by libavcodec.
1056 */
1057 AVPanScan *pan_scan;
1058
1059 /**1124 /**
1060 * Tell user application that palette has changed from previous frame.1125 * Tell user application that palette has changed from previous frame.
1061 * - encoding: ??? (no palette-enabled encoder yet)1126 * - encoding: ??? (no palette-enabled encoder yet)
@@ -1071,19 +1136,11 @@ typedef struct AVFrame { · 9 unmodified lines
1071 int buffer_hints;1136 int buffer_hints;
1072 1137
1073 /**1138 /**
1074 * DCT coefficients1139 * Pan scan.
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.
1083 * - encoding: Set by user.1140 * - encoding: Set by user.
1084 * - decoding: Set by libavcodec.1141 * - decoding: Set by libavcodec.
1085 */1142 */
1086 int8_t *ref_index[2];1143 AVPanScan *pan_scan;
1087 1144
1088 /**1145 /**
1089 * reordered opaque 64bit (generally an integer or a double precision float1146 * reordered opaque 64bit (generally an integer or a double precision float
@@ -1105,20 +1162,6 @@ typedef struct AVFrame { · 15 unmodified lines
1105 */1162 */
1106 void *hwaccel_picture_private;1163 void *hwaccel_picture_private;
1107 1164
1108 /**
1109 * reordered pts from the last AVPacket that has been input into the decoder
1110 * - encoding: unused
1111 * - decoding: Read by user.
1112 */
1113 int64_t pkt_pts;
1114
1115 /**
1116 * dts from the last AVPacket that has been input into the decoder
1117 * - encoding: unused
1118 * - decoding: Read by user.
1119 */
1120 int64_t pkt_dts;
1121
1122 /**1165 /**
1123 * the AVCodecContext which ff_thread_get_buffer() was last called on1166 * the AVCodecContext which ff_thread_get_buffer() was last called on
1124 * - encoding: Set by libavcodec.1167 * - encoding: Set by libavcodec.
@@ -1134,54 +1177,12 @@ typedef struct AVFrame { · 9 unmodified lines
1134 void *thread_opaque;1177 void *thread_opaque;
1135 1178
1136 /**1179 /**
1137 * number of audio samples (per channel) described by this frame1180 * log2 of the size of the block which a single vector in motion_val represents:
1138 * - encoding: Set by user1181 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
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)
1181 * - encoding: unused1182 * - encoding: unused
1182 * - decoding: Read by user.1183 * - decoding: Set by libavcodec.
1183 */1184 */
1184 int format;1185 uint8_t motion_subsample_log2;
1185 1186
1186 /**1187 /**
1187 * frame timestamp estimated using various heuristics, in stream time base1188 * frame timestamp estimated using various heuristics, in stream time base
@@ -1200,7 +1201,6 @@ typedef struct AVFrame { · 12 unmodified lines
1200 * - decoding: Read by user.1201 * - decoding: Read by user.
1201 */1202 */
1202 int64_t pkt_pos;1203 int64_t pkt_pos;
1203
1204} AVFrame;1204} AVFrame;
1205 1205
1206struct AVCodecInternal;1206struct AVCodecInternal;
@@ -1229,27 +1229,35 @@ typedef struct AVCodecContext { · 22 unmodified lines
1229 * - set by avcodec_alloc_context31229 * - set by avcodec_alloc_context3
1230 */1230 */
1231 const AVClass *av_class;1231 const AVClass *av_class;
1232 /**1232 int log_level_offset;
1233 * the average bitrate1233
1234 * - encoding: Set by user; unused for constant quantizer encoding.1234 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1235 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.1235 struct AVCodec *codec;
1236 */1236 char codec_name[32];
1237 int bit_rate;1237 enum CodecID codec_id; /* see CODEC_ID_xxx */
1238 1238
1239 /**1239 /**
1240 * number of bits the bitstream is allowed to diverge from the reference.1240 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1241 * the reference can be CBR (for CBR pass1) or VBR (for pass2)1241 * This is used to work around some encoder bugs.
1242 * - encoding: Set by user; unused for constant quantizer encoding.1242 * A demuxer should set this to what is stored in the field used to identify the codec.
1243 * - decoding: unused1243 * 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.
1244 */1251 */
1245 int bit_rate_tolerance;1252 unsigned int codec_tag;
1246 1253
1247 /**1254 /**
1248 * CODEC_FLAG_*.1255 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1249 * - encoding: Set by user.1256 * This is used to work around some encoder bugs.
1250 * - decoding: Set by user.1257 * - encoding: unused
1258 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1251 */1259 */
1252 int flags;1260 unsigned int stream_codec_tag;
1253 1261
1254 /**1262 /**
1255 * Some codecs need additional format info. It is stored here.1263 * Some codecs need additional format info. It is stored here.
@@ -1261,111 +1269,99 @@ typedef struct AVCodecContext { · 5 unmodified lines
1261 */1269 */
1262 int sub_id;1270 int sub_id;
1263 1271
1272 void *priv_data;
1273
1264 /**1274 /**
1265 * Motion estimation algorithm used for video coding.1275 * Private context used for internal data.
1266 * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),1276 *
1267 * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]1277 * Unlike priv_data, this is not codec-specific. It is used in general
1268 * - encoding: MUST be set by user.1278 * libavcodec functions.
1269 * - decoding: unused
1270 */1279 */
1271 int me_method;1280 struct AVCodecInternal *internal;
1272 1281
1273 /**1282 /**
1274 * some codecs need / can use extradata like Huffman tables.1283 * Private data of the user, can be used to carry app specific stuff.
1275 * mjpeg: Huffman tables1284 * - encoding: Set by user.
1276 * rv10: additional flags1285 * - decoding: Set by user.
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 */1286 */
1284 uint8_t *extradata;1287 void *opaque;
1285 int extradata_size;
1286 1288
1287 /**1289 /**
1288 * This is the fundamental unit of time (in seconds) in terms1290 * the average bitrate
1289 * of which frame timestamps are represented. For fixed-fps content,1291 * - encoding: Set by user; unused for constant quantizer encoding.
1290 * timebase should be 1/framerate and timestamp increments should be1292 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
1291 * identically 1.
1292 * - encoding: MUST be set by user.
1293 * - decoding: Set by libavcodec.
1294 */1293 */
1295 AVRational time_base;1294 int bit_rate;
1296 1295
1297 /* video only */
1298 /**1296 /**
1299 * picture width / height.1297 * number of bits the bitstream is allowed to diverge from the reference.
1300 * - encoding: MUST be set by user.1298 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
1301 * - decoding: Set by libavcodec.1299 * - encoding: Set by user; unused for constant quantizer encoding.
1302 * Note: For compatibility it is possible to set this instead of1300 * - decoding: unused
1303 * coded_width/height before decoding.
1304 */1301 */
1305 int width, height;1302 int bit_rate_tolerance;
1306 1303
1307#define FF_ASPECT_EXTENDED 151304 /**
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;
1308 1311
1309 /**1312 /**
1310 * the number of pictures in a group of pictures, or 0 for intra_only
1311 * - encoding: Set by user.1313 * - encoding: Set by user.
1312 * - decoding: unused1314 * - decoding: unused
1313 */1315 */
1314 int gop_size;1316 int compression_level;
1317#define FF_COMPRESSION_DEFAULT -1
1315 1318
1316 /**1319 /**
1317 * Pixel format, see PIX_FMT_xxx.1320 * CODEC_FLAG_*.
1318 * May be set by the demuxer if known from headers.
1319 * May be overriden by the decoder if it knows better.
1320 * - encoding: Set by user.1321 * - encoding: Set by user.
1321 * - decoding: Set by user if known, overridden by libavcodec if known1322 * - decoding: Set by user.
1322 */1323 */
1323 enum PixelFormat pix_fmt;1324 int flags;
1324 1325
1325 /**1326 /**
1326 * If non NULL, 'draw_horiz_band' is called by the libavcodec1327 * CODEC_FLAG2_*
1327 * decoder to draw a horizontal band. It improves cache usage. Not1328 * - encoding: Set by user.
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
1342 * - decoding: Set by user.1329 * - 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
1347 */1330 */
1348 void (*draw_horiz_band)(struct AVCodecContext *s,1331 int flags2;
1349 const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1350 int y, int type, int height);
1351 1332
1352 /* audio only */1333 /**
1353 int sample_rate; ///< samples per second1334 * some codecs need / can use extradata like Huffman tables.
1354 int channels; ///< number of audio channels1335 * 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;
1355 1346
1356 /**1347 /**
1357 * audio sample format1348 * This is the fundamental unit of time (in seconds) in terms
1358 * - encoding: Set by user.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.
1359 * - decoding: Set by libavcodec.1353 * - decoding: Set by libavcodec.
1360 */1354 */
1361 enum AVSampleFormat sample_fmt; ///< sample format1355 AVRational time_base;
1362 1356
1363 /* The following data should not be initialized. */
1364 /**1357 /**
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.
1366 */1363 */
1367 int frame_size;1364 int ticks_per_frame;
1368 int frame_number; ///< audio or video frame number
1369 1365
1370 /**1366 /**
1371 * Encoding: Number of frames delay there will be from the encoder input to1367 * Encoding: Number of frames delay there will be from the encoder input to
@@ -1390,30 +1386,88 @@ typedef struct AVCodecContext { · 18 unmodified lines
1390 */1386 */
1391 int delay;1387 int delay;
1392 1388
1393 /* - encoding parameters */
1394 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
1395 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
1396 1389
1390 /* video only */
1397 /**1391 /**
1398 * minimum quantizer1392 * picture width / height.
1399 * - encoding: Set by user.1393 * - encoding: MUST be set by user.
1400 * - decoding: unused1394 * - decoding: Set by libavcodec.
1395 * Note: For compatibility it is possible to set this instead of
1396 * coded_width/height before decoding.
1401 */1397 */
1402 int qmin;1398 int width, height;
1403 1399
1404 /**1400 /**
1405 * maximum quantizer1401 * 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
1406 * - encoding: Set by user.1411 * - encoding: Set by user.
1407 * - decoding: unused1412 * - decoding: unused
1408 */1413 */
1409 int qmax;1414 int gop_size;
1410 1415
1411 /**1416 /**
1412 * maximum quantizer difference between frames1417 * 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.
1413 * - encoding: Set by user.1420 * - 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.
1414 * - decoding: unused1430 * - decoding: unused
1415 */1431 */
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);
1417 1471
1418 /**1472 /**
1419 * maximum number of B-frames between non-B-frames1473 * maximum number of B-frames between non-B-frames
@@ -1438,739 +1492,637 @@ typedef struct AVCodecContext { · 18 unmodified lines
1438 1492
1439 int b_frame_strategy;1493 int b_frame_strategy;
1440 1494
1441 struct AVCodec *codec;1495 /**
1442 1496 * luma single coefficient elimination threshold
1443 void *priv_data;1497 * - encoding: Set by user.
1444 1498 * - decoding: unused
1445 int rtp_payload_size; /* The size of the RTP payload: the coder will */1499 */
1446 /* do its best to deliver a chunk with size */1500 int luma_elim_threshold;
1447 /* below rtp_payload_size, the chunk will start */
1448 /* with a start code on some codecs like H.263. */
1449 /* This doesn't take account of any particular */
1450 /* headers inside the transmitted RTP payload. */
1451
1452 1501
1453 /* The RTP callback: This function is called */1502 /**
1454 /* every time the encoder has a packet to send. */1503 * chroma single coeff elimination threshold
1455 /* It depends on the encoder if the data starts */1504 * - encoding: Set by user.
1456 /* with a Start Code (it should). H.263 does. */1505 * - decoding: unused
1457 /* mb_nb contains the number of macroblocks */1506 */
1458 /* encoded in the RTP payload. */1507 int chroma_elim_threshold;
1459 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
1460 1508
1461 /* statistics, used for 2-pass encoding */1509 /**
1462 int mv_bits;1510 * qscale offset between IP and B-frames
1463 int header_bits;1511 * - encoding: Set by user.
1464 int i_tex_bits;1512 * - decoding: unused
1465 int p_tex_bits;1513 */
1466 int i_count;1514 float b_quant_offset;
1467 int p_count;
1468 int skip_count;
1469 int misc_bits;
1470 1515
1471 /**1516 /**
1472 * number of bits used for the previously encoded frame1517 * Size of the frame reordering buffer in the decoder.
1518 * For MPEG-2 it is 1 IPB or 0 low delay IP.
1473 * - encoding: Set by libavcodec.1519 * - encoding: Set by libavcodec.
1474 * - decoding: unused1520 * - decoding: Set by libavcodec.
1475 */1521 */
1476 int frame_bits;1522 int has_b_frames;
1477 1523
1478 /**1524 /**
1479 * Private data of the user, can be used to carry app specific stuff.1525 * 0-> h263 quant 1-> mpeg quant
1480 * - encoding: Set by user.1526 * - encoding: Set by user.
1481 * - decoding: Set by user.1527 * - decoding: unused
1482 */1528 */
1483 void *opaque;1529 int mpeg_quant;
1484
1485 char codec_name[32];
1486 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1487 enum CodecID codec_id; /* see CODEC_ID_xxx */
1488 1530
1489 /**1531 /**
1490 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').1532 * qscale factor between P and I-frames
1491 * This is used to work around some encoder bugs.1533 * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1492 * A demuxer should set this to what is stored in the field used to identify the codec.1534 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1493 * If there are multiple such fields in a container then the demuxer should choose the one1535 * - encoding: Set by user.
1494 * which maximizes the information about the used codec.1536 * - decoding: unused
1495 * If the codec tag field in a container is larger than 32 bits then the demuxer should
1496 * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1497 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1498 * first.
1499 * - encoding: Set by user, if not then the default based on codec_id will be used.
1500 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1501 */1537 */
1502 unsigned int codec_tag;1538 float i_quant_factor;
1503 1539
1504 /**1540 /**
1505 * Work around bugs in encoders which sometimes cannot be detected automatically.1541 * qscale offset between P and I-frames
1506 * - encoding: Set by user1542 * - encoding: Set by user.
1507 * - decoding: Set by user1543 * - decoding: unused
1508 */1544 */
1509 int workaround_bugs;1545 float i_quant_offset;
1510#define FF_BUG_AUTODETECT 1 ///< autodetection
1511#define FF_BUG_OLD_MSMPEG4 2
1512#define FF_BUG_XVID_ILACE 4
1513#define FF_BUG_UMP4 8
1514#define FF_BUG_NO_PADDING 16
1515#define FF_BUG_AMV 32
1516#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
1517#define FF_BUG_QPEL_CHROMA 64
1518#define FF_BUG_STD_QPEL 128
1519#define FF_BUG_QPEL_CHROMA2 256
1520#define FF_BUG_DIRECT_BLOCKSIZE 512
1521#define FF_BUG_EDGE 1024
1522#define FF_BUG_HPEL_CHROMA 2048
1523#define FF_BUG_DC_CLIP 4096
1524#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
1525#define FF_BUG_TRUNCATED 16384
1526 1546
1527 /**1547 /**
1528 * luma single coefficient elimination threshold1548 * luminance masking (0-> disabled)
1529 * - encoding: Set by user.1549 * - encoding: Set by user.
1530 * - decoding: unused1550 * - decoding: unused
1531 */1551 */
1532 int luma_elim_threshold;1552 float lumi_masking;
1533 1553
1534 /**1554 /**
1535 * chroma single coeff elimination threshold1555 * temporary complexity masking (0-> disabled)
1536 * - encoding: Set by user.1556 * - encoding: Set by user.
1537 * - decoding: unused1557 * - decoding: unused
1538 */1558 */
1539 int chroma_elim_threshold;1559 float temporal_cplx_masking;
1540 1560
1541 /**1561 /**
1542 * strictly follow the standard (MPEG4, ...).1562 * spatial complexity masking (0-> disabled)
1543 * - encoding: Set by user.1563 * - encoding: Set by user.
1544 * - decoding: Set by user.1564 * - decoding: unused
1545 * Setting this to STRICT or higher means the encoder and decoder will
1546 * generally do stupid things, whereas setting it to unofficial or lower
1547 * will mean the encoder might produce output that is not supported by all
1548 * spec-compliant decoders. Decoders don't differentiate between normal,
1549 * unofficial and experimental (that is, they always try to decode things
1550 * when they can) unless they are explicitly asked to behave stupidly
1551 * (=strictly conform to the specs)
1552 */1565 */
1553 int strict_std_compliance;1566 float spatial_cplx_masking;
1554#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
1555#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
1556#define FF_COMPLIANCE_NORMAL 0
1557#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
1558#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
1559 1567
1560 /**1568 /**
1561 * qscale offset between IP and B-frames1569 * p block masking (0-> disabled)
1562 * - encoding: Set by user.1570 * - encoding: Set by user.
1563 * - decoding: unused1571 * - decoding: unused
1564 */1572 */
1565 float b_quant_offset;1573 float p_masking;
1566 1574
1567 /**1575 /**
1568 * Called at the beginning of each frame to get a buffer for it.1576 * darkness masking (0-> disabled)
1569 *1577 * - encoding: Set by user.
1570 * The function will set AVFrame.data[], AVFrame.linesize[].1578 * - decoding: unused
1571 * AVFrame.extended_data[] must also be set, but it should be the same as
1572 * AVFrame.data[] except for planar audio with more channels than can fit
1573 * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
1574 * many data pointers as it can hold.
1575 *
1576 * if CODEC_CAP_DR1 is not set then get_buffer() must call
1577 * avcodec_default_get_buffer() instead of providing buffers allocated by
1578 * some other means.
1579 *
1580 * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
1581 * need it. avcodec_default_get_buffer() aligns the output buffer properly,
1582 * but if get_buffer() is overridden then alignment considerations should
1583 * be taken into account.
1584 *
1585 * @see avcodec_default_get_buffer()
1586 *
1587 * Video:
1588 *
1589 * If pic.reference is set then the frame will be read later by libavcodec.
1590 * avcodec_align_dimensions2() should be used to find the required width and
1591 * height, as they normally need to be rounded up to the next multiple of 16.
1592 *
1593 * If frame multithreading is used and thread_safe_callbacks is set,
1594 * it may be called from a different thread, but not from more than one at
1595 * once. Does not need to be reentrant.
1596 *
1597 * @see release_buffer(), reget_buffer()
1598 * @see avcodec_align_dimensions2()
1599 *
1600 * Audio:
1601 *
1602 * Decoders request a buffer of a particular size by setting
1603 * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
1604 * however, utilize only part of the buffer by setting AVFrame.nb_samples
1605 * to a smaller value in the output frame.
1606 *
1607 * Decoders cannot use the buffer after returning from
1608 * avcodec_decode_audio4(), so they will not call release_buffer(), as it
1609 * is assumed to be released immediately upon return.
1610 *
1611 * As a convenience, av_samples_get_buffer_size() and
1612 * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
1613 * functions to find the required data size and to fill data pointers and
1614 * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
1615 * since all planes must be the same size.
1616 *
1617 * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
1618 *
1619 * - encoding: unused
1620 * - decoding: Set by libavcodec, user can override.
1621 */1579 */
1622 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);1580 float dark_masking;
1623 1581
1624 /**1582 /**
1625 * Called to release buffers which were allocated with get_buffer.1583 * slice count
1626 * A released buffer can be reused in get_buffer().1584 * - encoding: Set by libavcodec.
1627 * pic.data[*] must be set to NULL.1585 * - decoding: Set by user (or 0).
1628 * May be called from a different thread if frame multithreading is used,
1629 * but not by more than one thread at once, so does not need to be reentrant.
1630 * - encoding: unused
1631 * - decoding: Set by libavcodec, user can override.
1632 */1586 */
1633 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);1587 int slice_count;
1634
1635 /**1588 /**
1636 * Size of the frame reordering buffer in the decoder.1589 * prediction method (needed for huffyuv)
1637 * For MPEG-2 it is 1 IPB or 0 low delay IP.1590 * - encoding: Set by user.
1638 * - encoding: Set by libavcodec.1591 * - decoding: unused
1639 * - decoding: Set by libavcodec.
1640 */1592 */
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
1642 1597
1643 /**1598 /**
1644 * number of bytes per packet if constant and known or 01599 * slice offsets in the frame in bytes
1645 * Used by some WAV based audio codecs.1600 * - encoding: Set/allocated by libavcodec.
1601 * - decoding: Set/allocated by user (or NULL).
1646 */1602 */
1647 int block_align;1603 int *slice_offset;
1648 1604
1649 /**1605 /**
1650 * 0-> h263 quant 1-> mpeg quant1606 * 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.
1651 * - encoding: Set by user.1609 * - encoding: Set by user.
1652 * - decoding: unused1610 * - decoding: Set by libavcodec.
1653 */1611 */
1654 int mpeg_quant;1612 AVRational sample_aspect_ratio;
1655 1613
1656 /**1614 /**
1657 * pass1 encoding statistics output buffer1615 * motion estimation comparison function
1658 * - encoding: Set by libavcodec.1616 * - encoding: Set by user.
1659 * - decoding: unused1617 * - decoding: unused
1660 */1618 */
1661 char *stats_out;1619 int me_cmp;
1662
1663 /**1620 /**
1664 * pass2 encoding statistics input buffer1621 * subpixel motion estimation comparison function
1665 * Concatenated stuff from stats_out of pass1 should be placed here.1622 * - encoding: Set by user.
1666 * - encoding: Allocated/set/freed by user.
1667 * - decoding: unused1623 * - decoding: unused
1668 */1624 */
1669 char *stats_in;1625 int me_sub_cmp;
1670
1671 /**1626 /**
1672 * ratecontrol qmin qmax limiting method1627 * macroblock comparison function (not supported yet)
1673 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
1674 * - encoding: Set by user.1628 * - encoding: Set by user.
1675 * - decoding: unused1629 * - decoding: unused
1676 */1630 */
1677 float rc_qsquish;1631 int mb_cmp;
1678
1679 float rc_qmod_amp;
1680 int rc_qmod_freq;
1681
1682 /**1632 /**
1683 * ratecontrol override, see RcOverride1633 * interlaced DCT comparison function
1684 * - encoding: Allocated/set/freed by user.1634 * - encoding: Set by user.
1685 * - decoding: unused1635 * - decoding: unused
1686 */1636 */
1687 RcOverride *rc_override;1637 int ildct_cmp;
1688 int rc_override_count;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
1689 1654
1690 /**1655 /**
1691 * rate control equation1656 * ME diamond size & shape
1692 * - encoding: Set by user1657 * - encoding: Set by user.
1693 * - decoding: unused1658 * - decoding: unused
1694 */1659 */
1695 const char *rc_eq;1660 int dia_size;
1696 1661
1697 /**1662 /**
1698 * maximum bitrate1663 * amount of previous MV predictors (2a+1 x 2a+1 square)
1699 * - encoding: Set by user.1664 * - encoding: Set by user.
1700 * - decoding: unused1665 * - decoding: unused
1701 */1666 */
1702 int rc_max_rate;1667 int last_predictor_count;
1703 1668
1704 /**1669 /**
1705 * minimum bitrate1670 * prepass for motion estimation
1706 * - encoding: Set by user.1671 * - encoding: Set by user.
1707 * - decoding: unused1672 * - decoding: unused
1708 */1673 */
1709 int rc_min_rate;1674 int pre_me;
1710 1675
1711 /**1676 /**
1712 * decoder bitstream buffer size1677 * motion estimation prepass comparison function
1713 * - encoding: Set by user.1678 * - encoding: Set by user.
1714 * - decoding: unused1679 * - decoding: unused
1715 */1680 */
1716 int rc_buffer_size;1681 int me_pre_cmp;
1717 float rc_buffer_aggressivity;
1718 1682
1719 /**1683 /**
1720 * qscale factor between P and I-frames1684 * ME prepass diamond size & shape
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).
1723 * - encoding: Set by user.1685 * - encoding: Set by user.
1724 * - decoding: unused1686 * - decoding: unused
1725 */1687 */
1726 float i_quant_factor;1688 int pre_dia_size;
1727 1689
1728 /**1690 /**
1729 * qscale offset between P and I-frames1691 * subpel ME quality
1730 * - encoding: Set by user.1692 * - encoding: Set by user.
1731 * - decoding: unused1693 * - decoding: unused
1732 */1694 */
1733 float i_quant_offset;1695 int me_subpel_quality;
1734 1696
1735 /**1697 /**
1736 * initial complexity for pass1 ratecontrol1698 * DTG active format information (additional aspect ratio
1737 * - encoding: Set by user.1699 * information only used in DVB MPEG-2 transport streams)
1738 * - decoding: unused1700 * 0 if not set.
1701 *
1702 * - encoding: unused
1703 * - decoding: Set by decoder.
1739 */1704 */
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
1741 1713
1742 /**1714 /**
1743 * DCT algorithm, see FF_DCT_* below1715 * maximum motion estimation search range in subpel units
1716 * If 0 then no limit.
1717 *
1744 * - encoding: Set by user.1718 * - encoding: Set by user.
1745 * - decoding: unused1719 * - decoding: unused
1746 */1720 */
1747 int dct_algo;1721 int me_range;
1748#define FF_DCT_AUTO 0
1749#define FF_DCT_FASTINT 1
1750#define FF_DCT_INT 2
1751#define FF_DCT_MMX 3
1752#define FF_DCT_ALTIVEC 5
1753#define FF_DCT_FAAN 6
1754 1722
1755 /**1723 /**
1756 * luminance masking (0-> disabled)1724 * intra quantizer bias
1757 * - encoding: Set by user.1725 * - encoding: Set by user.
1758 * - decoding: unused1726 * - decoding: unused
1759 */1727 */
1760 float lumi_masking;1728 int intra_quant_bias;
1761 1729#define FF_DEFAULT_QUANT_BIAS 999999
1730
1762 /**1731 /**
1763 * temporary complexity masking (0-> disabled)1732 * inter quantizer bias
1764 * - encoding: Set by user.1733 * - encoding: Set by user.
1765 * - decoding: unused1734 * - decoding: unused
1766 */1735 */
1767 float temporal_cplx_masking;1736 int inter_quant_bias;
1768 1737
1769 /**1738 /**
1770 * spatial complexity masking (0-> disabled)1739 * color table ID
1771 * - encoding: Set by user.1740 * - encoding: unused
1772 * - decoding: unused1741 * - decoding: Which clrtable should be used for 8bit RGB images.
1742 * Tables have to be stored somewhere. FIXME
1773 */1743 */
1774 float spatial_cplx_masking;1744 int color_table_id;
1775 1745
1776 /**1746 /**
1777 * p block masking (0-> disabled)1747 * slice flags
1778 * - encoding: Set by user.1748 * - encoding: unused
1779 * - decoding: unused1749 * - decoding: Set by user.
1780 */1750 */
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)
1782 1755
1783 /**1756 /**
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
1785 * - encoding: Set by user.1765 * - encoding: Set by user.
1786 * - decoding: unused1766 * - decoding: unused
1787 */1767 */
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
1789 1772
1790 /**1773 /**
1791 * IDCT algorithm, see FF_IDCT_* below.1774 * custom intra quantization matrix
1792 * - encoding: Set by user.1775 * - encoding: Set by user, can be NULL.
1793 * - decoding: Set by user.1776 * - decoding: Set by libavcodec.
1794 */1777 */
1795 int idct_algo;1778 uint16_t *intra_matrix;
1796#define FF_IDCT_AUTO 0
1797#define FF_IDCT_INT 1
1798#define FF_IDCT_SIMPLE 2
1799#define FF_IDCT_SIMPLEMMX 3
1800#define FF_IDCT_LIBMPEG2MMX 4
1801#define FF_IDCT_MMI 5
1802#define FF_IDCT_ARM 7
1803#define FF_IDCT_ALTIVEC 8
1804#define FF_IDCT_SH4 9
1805#define FF_IDCT_SIMPLEARM 10
1806#define FF_IDCT_H264 11
1807#define FF_IDCT_VP3 12
1808#define FF_IDCT_IPP 13
1809#define FF_IDCT_XVIDMMX 14
1810#define FF_IDCT_CAVS 15
1811#define FF_IDCT_SIMPLEARMV5TE 16
1812#define FF_IDCT_SIMPLEARMV6 17
1813#define FF_IDCT_SIMPLEVIS 18
1814#define FF_IDCT_WMV2 19
1815#define FF_IDCT_FAAN 20
1816#define FF_IDCT_EA 21
1817#define FF_IDCT_SIMPLENEON 22
1818#define FF_IDCT_SIMPLEALPHA 23
1819#define FF_IDCT_BINK 24
1820 1779
1821 /**1780 /**
1822 * slice count1781 * custom inter quantization matrix
1823 * - encoding: Set by libavcodec.1782 * - encoding: Set by user, can be NULL.
1824 * - decoding: Set by user (or 0).1783 * - decoding: Set by libavcodec.
1825 */1784 */
1826 int slice_count;1785 uint16_t *inter_matrix;
1786
1827 /**1787 /**
1828 * slice offsets in the frame in bytes1788 * scene change detection threshold
1829 * - encoding: Set/allocated by libavcodec.1789 * 0 is default, larger means fewer detected scene changes.
1830 * - decoding: Set/allocated by user (or NULL).1790 * - encoding: Set by user.
1791 * - decoding: unused
1831 */1792 */
1832 int *slice_offset;1793 int scenechange_threshold;
1833 1794
1834 /**1795 /**
1835 * error concealment flags1796 * noise reduction strength
1836 * - encoding: unused1797 * - encoding: Set by user.
1837 * - decoding: Set by user.1798 * - decoding: unused
1838 */1799 */
1839 int error_concealment;1800 int noise_reduction;
1840#define FF_EC_GUESS_MVS 1
1841#define FF_EC_DEBLOCK 2
1842 1801
1843 /**1802 /**
1844 * dsp_mask could be add used to disable unwanted CPU features
1845 * CPU features (i.e. MMX, SSE. ...)
1846 *1803 *
1847 * With the FORCE flag you may instead enable given CPU features.1804 * - encoding: Set by user.
1848 * (Dangerous: Usable in case of misdetection, improper usage however will1805 * - decoding: unused
1849 * result into program crash.)
1850 */1806 */
1851 unsigned dsp_mask;1807 int inter_threshold;
1852 1808
1853 /**1809 /**
1854 * bits per sample/pixel from the demuxer (needed for huffyuv).1810 * quantizer noise shaping
1855 * - encoding: Set by libavcodec.1811 * - encoding: Set by user.
1856 * - decoding: Set by user.1812 * - decoding: unused
1857 */1813 */
1858 int bits_per_coded_sample;1814 int quantizer_noise_shaping;
1859 1815
1860 /**1816 /**
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 *
1862 * - encoding: Set by user.1820 * - encoding: Set by user.
1863 * - decoding: unused1821 * - decoding: unused
1864 */1822 */
1865 int prediction_method;1823 int me_threshold;
1866#define FF_PRED_LEFT 0
1867#define FF_PRED_PLANE 1
1868#define FF_PRED_MEDIAN 2
1869 1824
1870 /**1825 /**
1871 * sample aspect ratio (0 if unknown)1826 * Macroblock threshold below which the user specified macroblock types will be used.
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.
1874 * - encoding: Set by user.1827 * - encoding: Set by user.
1875 * - decoding: Set by libavcodec.1828 * - decoding: unused
1876 */1829 */
1877 AVRational sample_aspect_ratio;1830 int mb_threshold;
1878 1831
1879 /**1832 /**
1880 * the picture in the bitstream1833 * precision of the intra DC coefficient - 8
1881 * - encoding: Set by libavcodec.1834 * - encoding: Set by user.
1882 * - decoding: Set by libavcodec.1835 * - decoding: unused
1883 */1836 */
1884 AVFrame *coded_frame;1837 int intra_dc_precision;
1885 1838
1886 /**1839 /**
1887 * debug1840 * Number of macroblock rows at the top which are skipped.
1888 * - encoding: Set by user.1841 * - encoding: unused
1889 * - decoding: Set by user.1842 * - decoding: Set by user.
1890 */1843 */
1891 int debug;1844 int skip_top;
1892#define FF_DEBUG_PICT_INFO 1
1893#define FF_DEBUG_RC 2
1894#define FF_DEBUG_BITSTREAM 4
1895#define FF_DEBUG_MB_TYPE 8
1896#define FF_DEBUG_QP 16
1897#define FF_DEBUG_MV 32
1898#define FF_DEBUG_DCT_COEFF 0x00000040
1899#define FF_DEBUG_SKIP 0x00000080
1900#define FF_DEBUG_STARTCODE 0x00000100
1901#define FF_DEBUG_PTS 0x00000200
1902#define FF_DEBUG_ER 0x00000400
1903#define FF_DEBUG_MMCO 0x00000800
1904#define FF_DEBUG_BUGS 0x00001000
1905#define FF_DEBUG_VIS_QP 0x00002000
1906#define FF_DEBUG_VIS_MB_TYPE 0x00004000
1907#define FF_DEBUG_BUFFERS 0x00008000
1908#define FF_DEBUG_THREADS 0x00010000
1909 1845
1910 /**1846 /**
1911 * debug1847 * Number of macroblock rows at the bottom which are skipped.
1912 * - encoding: Set by user.1848 * - encoding: unused
1913 * - decoding: Set by user.1849 * - decoding: Set by user.
1914 */1850 */
1915 int debug_mv;1851 int skip_bottom;
1916#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
1917#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
1918#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
1919 1852
1920 /**1853 /**
1921 * error1854 * Border processing masking, raises the quantizer for mbs on the borders
1922 * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.1855 * of the picture.
1856 * - encoding: Set by user.
1923 * - decoding: unused1857 * - decoding: unused
1924 */1858 */
1925 uint64_t error[AV_NUM_DATA_POINTERS];1859 float border_masking;
1926 1860
1927 /**1861 /**
1928 * motion estimation comparison function1862 * minimum MB lagrange multipler
1929 * - encoding: Set by user.1863 * - encoding: Set by user.
1930 * - decoding: unused1864 * - decoding: unused
1931 */1865 */
1932 int me_cmp;1866 int mb_lmin;
1867
1933 /**1868 /**
1934 * subpixel motion estimation comparison function1869 * maximum MB lagrange multipler
1935 * - encoding: Set by user.1870 * - encoding: Set by user.
1936 * - decoding: unused1871 * - decoding: unused
1937 */1872 */
1938 int me_sub_cmp;1873 int mb_lmax;
1874
1939 /**1875 /**
1940 * macroblock comparison function (not supported yet)1876 *
1941 * - encoding: Set by user.1877 * - encoding: Set by user.
1942 * - decoding: unused1878 * - decoding: unused
1943 */1879 */
1944 int mb_cmp;1880 int me_penalty_compensation;
1881
1945 /**1882 /**
1946 * interlaced DCT comparison function1883 *
1947 * - encoding: Set by user.1884 * - encoding: Set by user.
1948 * - decoding: unused1885 * - decoding: unused
1949 */1886 */
1950 int ildct_cmp;1887 int bidir_refine;
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
1967 1888
1968 /**1889 /**
1969 * ME diamond size & shape1890 *
1970 * - encoding: Set by user.1891 * - encoding: Set by user.
1971 * - decoding: unused1892 * - decoding: unused
1972 */1893 */
1973 int dia_size;1894 int brd_scale;
1974 1895
1975 /**1896 /**
1976 * amount of previous MV predictors (2a+1 x 2a+1 square)1897 * minimum GOP size
1977 * - encoding: Set by user.1898 * - encoding: Set by user.
1978 * - decoding: unused1899 * - decoding: unused
1979 */1900 */
1980 int last_predictor_count;1901 int keyint_min;
1981 1902
1982 /**1903 /**
1983 * prepass for motion estimation1904 * 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
1984 * - encoding: Set by user.1912 * - encoding: Set by user.
1985 * - decoding: unused1913 * - decoding: unused
1986 */1914 */
1987 int pre_me;1915 int chromaoffset;
1988 1916
1989 /**1917 /**
1990 * motion estimation prepass comparison function1918 * Multiplied by qscale for each frame and added to scene_change_score.
1991 * - encoding: Set by user.1919 * - encoding: Set by user.
1992 * - decoding: unused1920 * - decoding: unused
1993 */1921 */
1994 int me_pre_cmp;1922 int scenechange_factor;
1995 1923
1996 /**1924 /**
1997 * ME prepass diamond size & shape1925 *
1926 * Note: Value depends upon the compare function used for fullpel ME.
1998 * - encoding: Set by user.1927 * - encoding: Set by user.
1999 * - decoding: unused1928 * - decoding: unused
2000 */1929 */
2001 int pre_dia_size;1930 int mv0_threshold;
2002 1931
2003 /**1932 /**
2004 * subpel ME quality1933 * Adjust sensitivity of b_frame_strategy 1.
2005 * - encoding: Set by user.1934 * - encoding: Set by user.
2006 * - decoding: unused1935 * - decoding: unused
2007 */1936 */
2008 int me_subpel_quality;1937 int b_sensitivity;
2009 1938
2010 /**1939 /**
2011 * callback to negotiate the pixelFormat1940 * Chromaticity coordinates of the source primaries.
2012 * @param fmt is the list of formats which are supported by the codec,1941 * - encoding: Set by user
2013 * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.1942 * - decoding: Set by libavcodec
2014 * The first is always the native one.
2015 * @return the chosen format
2016 * - encoding: unused
2017 * - decoding: Set by user, if not set the native format will be chosen.
2018 */1943 */
2019 enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);1944 enum AVColorPrimaries color_primaries;
2020 1945
2021 /**1946 /**
2022 * DTG active format information (additional aspect ratio1947 * Color Transfer Characteristic.
2023 * information only used in DVB MPEG-2 transport streams)1948 * - encoding: Set by user
2024 * 0 if not set.1949 * - decoding: Set by libavcodec
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
2044 */1950 */
2045 int me_range;1951 enum AVColorTransferCharacteristic color_trc;
2046 1952
2047 /**1953 /**
2048 * intra quantizer bias1954 * YUV colorspace type.
2049 * - encoding: Set by user.1955 * - encoding: Set by user
2050 * - decoding: unused1956 * - decoding: Set by libavcodec
2051 */1957 */
2052 int intra_quant_bias;1958 enum AVColorSpace colorspace;
2053#define FF_DEFAULT_QUANT_BIAS 999999
2054 1959
2055 /**1960 /**
2056 * inter quantizer bias1961 * MPEG vs JPEG YUV range.
2057 * - encoding: Set by user.1962 * - encoding: Set by user
2058 * - decoding: unused1963 * - decoding: Set by libavcodec
2059 */1964 */
2060 int inter_quant_bias;1965 enum AVColorRange color_range;
2061 1966
2062 /**1967 /**
2063 * color table ID1968 * This defines the location of chroma samples.
2064 * - encoding: unused1969 * - encoding: Set by user
2065 * - decoding: Which clrtable should be used for 8bit RGB images.1970 * - decoding: Set by libavcodec
2066 * Tables have to be stored somewhere. FIXME
2067 */1971 */
2068 int color_table_id;1972 enum AVChromaLocation chroma_sample_location;
2069 1973
2070 /**1974 /**
2071 * Global quality for codecs which cannot change it per frame.1975 * Number of slices.
2072 * This should be proportional to MPEG-1/2/4 qscale.1976 * Indicates number of picture subdivisions. Used for parallelized
2073 * - encoding: Set by user.1977 * decoding.
1978 * - encoding: Set by user
2074 * - decoding: unused1979 * - decoding: unused
2075 */1980 */
2076 int global_quality;1981 int slices;
2077 1982
2078#define FF_CODER_TYPE_VLC 01983 /** Field order
2079#define FF_CODER_TYPE_AC 11984 * - encoding: set by libavcodec
2080#define FF_CODER_TYPE_RAW 21985 * - decoding: Set by libavcodec
2081#define FF_CODER_TYPE_RLE 3
2082#define FF_CODER_TYPE_DEFLATE 4
2083 /**
2084 * coder type
2085 * - encoding: Set by user.
2086 * - decoding: unused
2087 */1986 */
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
2089 1992
2090 /**1993 /**
2091 * context model1994 * audio sample format
2092 * - encoding: Set by user.1995 * - encoding: Set by user.
2093 * - decoding: unused1996 * - decoding: Set by libavcodec.
2094 */1997 */
2095 int context_model;1998 enum AVSampleFormat sample_fmt; ///< sample format
2096 1999
2000 /* The following data should not be initialized. */
2097 /**2001 /**
2098 * slice flags2002 * Samples per packet, initialized when calling 'init'.
2099 * - encoding: unused
2100 * - decoding: Set by user.
2101 */2003 */
2102 int slice_flags;2004 int frame_size;
2103#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display2005 int frame_number; ///< audio or video frame number
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)
2106 2006
2107 /**2007 /**
2108 * XVideo Motion Acceleration2008 * number of bytes per packet if constant and known or 0
2109 * - encoding: forbidden2009 * Used by some WAV based audio codecs.
2110 * - decoding: set by decoder
2111 */2010 */
2112 int xvmc_acceleration;2011 int block_align;
2113 2012
2114 /**2013 /**
2115 * macroblock decision mode2014 * Audio cutoff bandwidth (0 means "automatic")
2116 * - encoding: Set by user.2015 * - encoding: Set by user.
2117 * - decoding: unused2016 * - decoding: unused
2118 */2017 */
2119 int mb_decision;2018 int cutoff;
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
2123 2019
2020#if FF_API_REQUEST_CHANNELS
2124 /**2021 /**
2125 * custom intra quantization matrix2022 * Decoder should decode to this many channels if it can (0 for default)
2126 * - encoding: Set by user, can be NULL.2023 * - encoding: unused
2127 * - decoding: Set by libavcodec.2024 * - decoding: Set by user.
2025 * @deprecated Deprecated in favor of request_channel_layout.
2128 */2026 */
2129 uint16_t *intra_matrix;2027 int request_channels;
2028#endif
2130 2029
2131 /**2030 /**
2132 * custom inter quantization matrix2031 * Audio channel layout.
2133 * - encoding: Set by user, can be NULL.2032 * - encoding: set by user.
2134 * - decoding: Set by libavcodec.2033 * - decoding: set by user, may be overwritten by libavcodec.
2135 */2034 */
2136 uint16_t *inter_matrix;2035 uint64_t channel_layout;
2137 2036
2138 /**2037 /**
2139 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').2038 * Request decoder to use this channel layout if it can (0 for default)
2140 * This is used to work around some encoder bugs.
2141 * - encoding: unused2039 * - encoding: unused
2142 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.2040 * - decoding: Set by user.
2143 */2041 */
2144 unsigned int stream_codec_tag;2042 uint64_t request_channel_layout;
2145 2043
2146 /**2044 /**
2147 * scene change detection threshold2045 * Type of service that the audio stream conveys.
2148 * 0 is default, larger means fewer detected scene changes.
2149 * - encoding: Set by user.2046 * - encoding: Set by user.
2150 * - decoding: unused2047 * - decoding: Set by libavcodec.
2151 */2048 */
2152 int scenechange_threshold;2049 enum AVAudioServiceType audio_service_type;
2153 2050
2154 /**2051 /**
2155 * minimum Lagrange multipler2052 * desired sample format
2156 * - encoding: Set by user.2053 * - encoding: Not used.
2157 * - decoding: unused2054 * - decoding: Set by user.
2055 * Decoder will decode to this format if it can.
2158 */2056 */
2159 int lmin;2057 enum AVSampleFormat request_sample_fmt;
2160 2058
2161 /**2059 /**
2162 * maximum Lagrange multipler2060 * Called at the beginning of each frame to get a buffer for it.
2163 * - encoding: Set by user.2061 *
2164 * - decoding: unused2062 * 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.
2165 */2113 */
2166 int lmax;2114 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
2167 2115
2168 /**2116 /**
2169 * noise reduction strength2117 * Called to release buffers which were allocated with get_buffer.
2170 * - encoding: Set by user.2118 * A released buffer can be reused in get_buffer().
2171 * - decoding: unused2119 * 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.
2172 */2124 */
2173 int noise_reduction;2125 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
2174 2126
2175 /**2127 /**
2176 * Called at the beginning of a frame to get cr buffer for it.2128 * Called at the beginning of a frame to get cr buffer for it.
@@ -2186,199 +2138,141 @@ typedef struct AVCodecContext { · 9 unmodified lines
2186 */2138 */
2187 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);2139 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
2188 2140
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
2189 /**2146 /**
2190 * Number of bits which should be loaded into the rc buffer before decoding starts.2147 * minimum quantizer
2191 * - encoding: Set by user.2148 * - encoding: Set by user.
2192 * - decoding: unused2149 * - decoding: unused
2193 */2150 */
2194 int rc_initial_buffer_occupancy;2151 int qmin;
2195 2152
2196 /**2153 /**
2197 *2154 * maximum quantizer
2198 * - encoding: Set by user.2155 * - encoding: Set by user.
2199 * - decoding: unused2156 * - decoding: unused
2200 */2157 */
2201 int inter_threshold;2158 int qmax;
2202 2159
2203 /**2160 /**
2204 * CODEC_FLAG2_*2161 * maximum quantizer difference between frames
2205 * - encoding: Set by user.2162 * - encoding: Set by user.
2206 * - decoding: Set by user.2163 * - decoding: unused
2207 */2164 */
2208 int flags2;2165 int max_qdiff;
2209 2166
2210 /**2167 /**
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.
2212 * - encoding: Set by user.2170 * - encoding: Set by user.
2213 * - decoding: unused2171 * - decoding: unused
2214 */2172 */
2215 int error_rate;2173 float rc_qsquish;
2174
2175 float rc_qmod_amp;
2176 int rc_qmod_freq;
2216 2177
2217 /**2178 /**
2218 * quantizer noise shaping2179 * decoder bitstream buffer size
2219 * - encoding: Set by user.2180 * - encoding: Set by user.
2220 * - decoding: unused2181 * - decoding: unused
2221 */2182 */
2222 int quantizer_noise_shaping;2183 int rc_buffer_size;
2223 2184
2224 /**2185 /**
2225 * thread count2186 * ratecontrol override, see RcOverride
2226 * is used to decide how many independent tasks should be passed to execute()2187 * - encoding: Allocated/set/freed by user.
2227 * - encoding: Set by user.2188 * - decoding: unused
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.
2240 */2189 */
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;
2242 2192
2243 /**2193 /**
2244 * thread opaque2194 * rate control equation
2245 * Can be used by execute() to store some per AVCodecContext stuff.2195 * - encoding: Set by user
2246 * - encoding: set by execute()2196 * - decoding: unused
2247 * - decoding: set by execute()
2248 */2197 */
2249 void *thread_opaque;2198 const char *rc_eq;
2250 2199
2251 /**2200 /**
2252 * Motion estimation threshold below which no motion estimation is2201 * maximum bitrate
2253 * performed, but instead the user specified motion vectors are used.
2254 *
2255 * - encoding: Set by user.2202 * - encoding: Set by user.
2256 * - decoding: unused2203 * - decoding: unused
2257 */2204 */
2258 int me_threshold;2205 int rc_max_rate;
2259 2206
2260 /**2207 /**
2261 * Macroblock threshold below which the user specified macroblock types will be used.2208 * minimum bitrate
2262 * - encoding: Set by user.2209 * - encoding: Set by user.
2263 * - decoding: unused2210 * - decoding: unused
2264 */2211 */
2265 int mb_threshold;2212 int rc_min_rate;
2213
2214 float rc_buffer_aggressivity;
2266 2215
2267 /**2216 /**
2268 * precision of the intra DC coefficient - 82217 * initial complexity for pass1 ratecontrol
2269 * - encoding: Set by user.2218 * - encoding: Set by user.
2270 * - decoding: unused2219 * - decoding: unused
2271 */2220 */
2272 int intra_dc_precision;2221 float rc_initial_cplx;
2273 2222
2274 /**2223 /**
2275 * noise vs. sse weight for the nsse comparsion function2224 * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2276 * - encoding: Set by user.2225 * - encoding: Set by user.
2277 * - decoding: unused2226 * - decoding: unused.
2278 */2227 */
2279 int nsse_weight;2228 float rc_max_available_vbv_use;
2280 2229
2281 /**2230 /**
2282 * Number of macroblock rows at the top which are skipped.2231 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2283 * - encoding: unused2232 * - encoding: Set by user.
2284 * - decoding: Set by user.2233 * - decoding: unused.
2285 */2234 */
2286 int skip_top;2235 float rc_min_vbv_overflow_use;
2287 2236
2288 /**2237 /**
2289 * Number of macroblock rows at the bottom which are skipped.2238 * Number of bits which should be loaded into the rc buffer before decoding starts.
2290 * - encoding: unused2239 * - encoding: Set by user.
2291 * - decoding: Set by user.2240 * - decoding: unused
2292 */2241 */
2293 int skip_bottom;2242 int rc_initial_buffer_occupancy;
2294 2243
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
2295 /**2249 /**
2296 * profile2250 * coder type
2297 * - encoding: Set by user.2251 * - encoding: Set by user.
2298 * - decoding: Set by libavcodec.2252 * - decoding: unused
2299 */2253 */
2300 int profile;2254 int coder_type;
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
2360 2255
2361 /**2256 /**
2362 * level2257 * context model
2363 * - encoding: Set by user.2258 * - encoding: Set by user.
2364 * - decoding: Set by libavcodec.2259 * - decoding: unused
2365 */2260 */
2366 int level;2261 int context_model;
2367#define FF_LEVEL_UNKNOWN -99
2368 2262
2369 /**2263 /**
2370 * low resolution decoding, 1-> 1/2 size, 2->1/4 size2264 * minimum Lagrange multipler
2371 * - encoding: unused2265 * - encoding: Set by user.
2372 * - decoding: Set by user.2266 * - decoding: unused
2373 */2267 */
2374 int lowres;2268 int lmin;
2375 2269
2376 /**2270 /**
2377 * Bitstream width / height, may be different from width/height if lowres enabled.2271 * maximum Lagrange multipler
2378 * - encoding: unused2272 * - encoding: Set by user.
2379 * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.2273 * - decoding: unused
2380 */2274 */
2381 int coded_width, coded_height;2275 int lmax;
2382 2276
2383 /**2277 /**
2384 * frame skip threshold2278 * frame skip threshold
@@ -2409,170 +2303,274 @@ typedef struct AVCodecContext { · 24 unmodified lines
2409 int frame_skip_cmp;2303 int frame_skip_cmp;
2410 2304
2411 /**2305 /**
2412 * Border processing masking, raises the quantizer for mbs on the borders2306 * trellis RD quantization
2413 * of the picture.
2414 * - encoding: Set by user.2307 * - encoding: Set by user.
2415 * - decoding: unused2308 * - decoding: unused
2416 */2309 */
2417 float border_masking;2310 int trellis;
2418 2311
2419 /**2312 /**
2420 * minimum MB lagrange multipler
2421 * - encoding: Set by user.2313 * - encoding: Set by user.
2422 * - decoding: unused2314 * - decoding: unused
2423 */2315 */
2424 int mb_lmin;2316 int min_prediction_order;
2425 2317
2426 /**2318 /**
2427 * maximum MB lagrange multipler
2428 * - encoding: Set by user.2319 * - encoding: Set by user.
2429 * - decoding: unused2320 * - decoding: unused
2430 */2321 */
2431 int mb_lmax;2322 int max_prediction_order;
2432 2323
2433 /**2324 /**
2434 *2325 * GOP timecode frame start number
2435 * - encoding: Set by user.2326 * - encoding: Set by user, in non drop frame format
2436 * - decoding: unused2327 * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)
2437 */2328 */
2438 int me_penalty_compensation;2329 int64_t timecode_frame_start;
2439 2330
2440 /**2331 /* The RTP callback: This function is called */
2441 *2332 /* every time the encoder has a packet to send. */
2442 * - encoding: unused2333 /* It depends on the encoder if the data starts */
2443 * - decoding: Set by user.2334 /* with a Start Code (it should). H.263 does. */
2444 */2335 /* mb_nb contains the number of macroblocks */
2445 enum AVDiscard skip_loop_filter;2336 /* encoded in the RTP payload. */
2337 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
2446 2338
2447 /**2339 int rtp_payload_size; /* The size of the RTP payload: the coder will */
2448 *2340 /* do its best to deliver a chunk with size */
2449 * - encoding: unused2341 /* below rtp_payload_size, the chunk will start */
2450 * - decoding: Set by user.2342 /* with a start code on some codecs like H.263. */
2451 */2343 /* This doesn't take account of any particular */
2452 enum AVDiscard skip_idct;2344 /* headers inside the transmitted RTP payload. */
2453 2345
2454 /**2346 /* statistics, used for 2-pass encoding */
2455 *2347 int mv_bits;
2456 * - encoding: unused2348 int header_bits;
2457 * - decoding: Set by user.2349 int i_tex_bits;
2458 */2350 int p_tex_bits;
2459 enum AVDiscard skip_frame;2351 int i_count;
2352 int p_count;
2353 int skip_count;
2354 int misc_bits;
2460 2355
2461 /**2356 /**
2462 *2357 * number of bits used for the previously encoded frame
2463 * - encoding: Set by user.2358 * - encoding: Set by libavcodec.
2464 * - decoding: unused2359 * - decoding: unused
2465 */2360 */
2466 int bidir_refine;2361 int frame_bits;
2467 2362
2468 /**2363 /**
2469 *2364 * pass1 encoding statistics output buffer
2470 * - encoding: Set by user.2365 * - encoding: Set by libavcodec.
2471 * - decoding: unused2366 * - decoding: unused
2472 */2367 */
2473 int brd_scale;2368 char *stats_out;
2474 2369
2475 /**2370 /**
2476 * minimum GOP size2371 * pass2 encoding statistics input buffer
2477 * - encoding: Set by user.2372 * Concatenated stuff from stats_out of pass1 should be placed here.
2373 * - encoding: Allocated/set/freed by user.
2478 * - decoding: unused2374 * - decoding: unused
2479 */2375 */
2480 int keyint_min;2376 char *stats_in;
2481 2377
2482 /**2378 /**
2483 * number of reference frames2379 * Work around bugs in encoders which sometimes cannot be detected automatically.
2484 * - encoding: Set by user.2380 * - encoding: Set by user
2485 * - decoding: Set by lavc.2381 * - decoding: Set by user
2486 */2382 */
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
2488 2400
2489 /**2401 /**
2490 * chroma qp offset from luma2402 * strictly follow the standard (MPEG4, ...).
2491 * - encoding: Set by user.2403 * - encoding: Set by user.
2492 * - decoding: unused2404 * - 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)
2493 */2412 */
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.
2495 2419
2496 /**2420 /**
2497 * trellis RD quantization2421 * error concealment flags
2498 * - encoding: Set by user.2422 * - encoding: unused
2499 * - decoding: unused2423 * - decoding: Set by user.
2500 */2424 */
2501 int trellis;2425 int error_concealment;
2426#define FF_EC_GUESS_MVS 1
2427#define FF_EC_DEBLOCK 2
2502 2428
2503 /**2429 /**
2504 * Audio cutoff bandwidth (0 means "automatic")2430 * debug
2505 * - encoding: Set by user.2431 * - encoding: Set by user.
2506 * - decoding: unused2432 * - decoding: Set by user.
2507 */2433 */
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
2509 2452
2510 /**2453 /**
2511 * Multiplied by qscale for each frame and added to scene_change_score.2454 * debug
2512 * - encoding: Set by user.2455 * - encoding: Set by user.
2513 * - decoding: unused2456 * - decoding: Set by user.
2514 */2457 */
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
2516 2462
2517 /**2463 /**
2518 *2464 * Error recognition; may misdetect some more or less valid parts as errors.
2519 * Note: Value depends upon the compare function used for fullpel ME.2465 * - encoding: unused
2520 * - encoding: Set by user.2466 * - decoding: Set by user.
2521 * - decoding: unused
2522 */2467 */
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
2524 2478
2525 /**2479 /**
2526 * Adjust sensitivity of b_frame_strategy 1.2480 * opaque 64bit number (generally a PTS) that will be reordered and
2527 * - encoding: Set by user.2481 * output in AVFrame.reordered_opaque
2528 * - decoding: unused2482 * @deprecated in favor of pkt_pts
2483 * - encoding: unused
2484 * - decoding: Set by user.
2529 */2485 */
2530 int b_sensitivity;2486 int64_t reordered_opaque;
2531 2487
2532 /**2488 /**
2533 * - encoding: Set by user.2489 * Hardware accelerator in use
2534 * - decoding: unused2490 * - encoding: unused.
2491 * - decoding: Set by libavcodec
2535 */2492 */
2536 int compression_level;2493 struct AVHWAccel *hwaccel;
2537#define FF_COMPRESSION_DEFAULT -1
2538 2494
2539 /**2495 /**
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.
2541 * - decoding: unused2510 * - decoding: unused
2542 */2511 */
2543 int min_prediction_order;2512 uint64_t error[AV_NUM_DATA_POINTERS];
2544 2513
2545 /**2514 /**
2515 * DCT algorithm, see FF_DCT_* below
2546 * - encoding: Set by user.2516 * - encoding: Set by user.
2547 * - decoding: unused2517 * - decoding: unused
2548 */2518 */
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
2550 2526
2551 /**2527 /**
2552 * GOP timecode frame start number2528 * IDCT algorithm, see FF_IDCT_* below.
2553 * - encoding: Set by user, in non drop frame format2529 * - encoding: Set by user.
2554 * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)2530 * - decoding: Set by user.
2555 */2531 */
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
2557 2557
2558#if FF_API_REQUEST_CHANNELS
2559 /**2558 /**
2560 * Decoder should decode to this many channels if it can (0 for default)2559 * dsp_mask could be add used to disable unwanted CPU features
2561 * - encoding: unused2560 * CPU features (i.e. MMX, SSE. ...)
2562 * - decoding: Set by user.2561 *
2563 * @deprecated Deprecated in favor of request_channel_layout.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.)
2564 */2565 */
2565 int request_channels;2566 unsigned dsp_mask;
2566#endif
2567 2567
2568 /**2568 /**
2569 * opaque 64bit number (generally a PTS) that will be reordered and2569 * bits per sample/pixel from the demuxer (needed for huffyuv).
2570 * output in AVFrame.reordered_opaque2570 * - encoding: Set by libavcodec.
2571 * @deprecated in favor of pkt_pts
2572 * - encoding: unused
2573 * - decoding: Set by user.2571 * - decoding: Set by user.
2574 */2572 */
2575 int64_t reordered_opaque;2573 int bits_per_coded_sample;
2576 2574
2577 /**2575 /**
2578 * Bits per sample/pixel of internal libavcodec pixel/sample format.2576 * Bits per sample/pixel of internal libavcodec pixel/sample format.
@@ -2582,95 +2580,66 @@ typedef struct AVCodecContext { · 3 unmodified lines
2582 int bits_per_raw_sample;2580 int bits_per_raw_sample;
2583 2581
2584 /**2582 /**
2585 * Audio channel layout.2583 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
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)
2593 * - encoding: unused2584 * - encoding: unused
2594 * - decoding: Set by user.2585 * - decoding: Set by user.
2595 */2586 */
2596 uint64_t request_channel_layout;2587 int lowres;
2597 2588
2598 /**2589 /**
2599 * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.2590 * the picture in the bitstream
2600 * - encoding: Set by user.2591 * - encoding: Set by libavcodec.
2601 * - decoding: unused.2592 * - decoding: Set by libavcodec.
2602 */2593 */
2603 float rc_max_available_vbv_use;2594 AVFrame *coded_frame;
2604 2595
2605 /**2596 /**
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()
2607 * - encoding: Set by user.2599 * - encoding: Set by user.
2608 * - decoding: unused.2600 * - decoding: Set by user.
2609 */
2610 float rc_min_vbv_overflow_use;
2611
2612 /**
2613 * Hardware accelerator in use
2614 * - encoding: unused.
2615 * - decoding: Set by libavcodec
2616 */2601 */
2617 struct AVHWAccel *hwaccel;2602 int thread_count;
2618 2603
2619 /**2604 /**
2620 * For some codecs, the time base is closer to the field rate than the frame rate.2605 * Which multithreading methods to use.
2621 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration2606 * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2622 * if no telecine is used ...2607 * so clients which cannot provide future frames should not use it.
2623 *2608 *
2624 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.2609 * - encoding: Set by user, otherwise the default is used.
2625 */2610 * - decoding: Set by user, otherwise the default is used.
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
2651 */2611 */
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
2653 2615
2654 /**2616 /**
2655 * YUV colorspace type.2617 * Which multithreading methods are in use by the codec.
2656 * - encoding: Set by user2618 * - encoding: Set by libavcodec.
2657 * - decoding: Set by libavcodec2619 * - decoding: Set by libavcodec.
2658 */2620 */
2659 enum AVColorSpace colorspace;2621 int active_thread_type;
2660 2622
2661 /**2623 /**
2662 * MPEG vs JPEG YUV range.2624 * Set by the client if its custom get_buffer() callback can be called
2663 * - encoding: Set by user2625 * from another thread, which allows faster multithreaded decoding.
2664 * - decoding: Set by libavcodec2626 * 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.
2665 */2630 */
2666 enum AVColorRange color_range;2631 int thread_safe_callbacks;
2667 2632
2668 /**2633 /**
2669 * This defines the location of chroma samples.2634 * The codec may call this to execute several independent things.
2670 * - encoding: Set by user2635 * It will return only after finishing all tasks.
2671 * - decoding: Set by libavcodec2636 * 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.
2672 */2641 */
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);
2674 2643
2675 /**2644 /**
2676 * The codec may call this to execute several independent things.2645 * The codec may call this to execute several independent things.
@@ -2692,117 +2661,150 @@ typedef struct AVCodecContext { · 15 unmodified lines
2692 */2661 */
2693 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);2662 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
2694 2663
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;
2696 2671
2697 /**2672 /**
2698 * Number of slices.2673 * noise vs. sse weight for the nsse comparsion function
2699 * Indicates number of picture subdivisions. Used for parallelized2674 * - encoding: Set by user.
2700 * decoding.
2701 * - encoding: Set by user
2702 * - decoding: unused2675 * - decoding: unused
2703 */2676 */
2704 int slices;2677 int nsse_weight;
2705 2678
2706 /**2679 /**
2707 * Header containing style information for text subtitles.2680 * profile
2708 * For SUBTITLE_ASS subtitle type, it should contain the whole ASS2681 * - encoding: Set by user.
2709 * [Script Info] and [V4+ Styles] section, plus the [Events] line and2682 * - decoding: Set by libavcodec.
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())
2713 */2683 */
2714 uint8_t *subtitle_header;2684 int profile;
2715 int subtitle_header_size;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
2716 2744
2717 /**2745 /**
2718 * Current packet as passed into the decoder, to avoid having2746 * level
2719 * to pass the packet into every function. Currently only valid2747 * - encoding: Set by user.
2720 * inside lavc and get/release_buffer callbacks.2748 * - decoding: Set by libavcodec.
2721 * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
2722 * - encoding: unused
2723 */2749 */
2724 AVPacket *pkt;2750 int level;
2751#define FF_LEVEL_UNKNOWN -99
2725 2752
2726 /**2753 /**
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.
2730 *2754 *
2731 * - encoding: Set by user, otherwise the default is used.2755 * - encoding: unused
2732 * - decoding: Set by user, otherwise the default is used.2756 * - decoding: Set by user.
2733 */2757 */
2734 int thread_type;2758 enum AVDiscard skip_loop_filter;
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
2737 2759
2738 /**2760 /**
2739 * Which multithreading methods are in use by the codec.2761 *
2740 * - encoding: Set by libavcodec.2762 * - encoding: unused
2741 * - decoding: Set by libavcodec.2763 * - decoding: Set by user.
2742 */2764 */
2743 int active_thread_type;2765 enum AVDiscard skip_idct;
2744 2766
2745 /**2767 /**
2746 * Set by the client if its custom get_buffer() callback can be called2768 *
2747 * from another thread, which allows faster multithreaded decoding.2769 * - encoding: unused
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.
2751 * - decoding: Set by user.2770 * - decoding: Set by user.
2752 */2771 */
2753 int thread_safe_callbacks;2772 enum AVDiscard skip_frame;
2754 2773
2755 /**2774 /**
2756 * VBV delay coded in the last frame (in periods of a 27 MHz clock).2775 * Header containing style information for text subtitles.
2757 * Used for compliant TS muxing.2776 * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
2758 * - encoding: Set by libavcodec.2777 * [Script Info] and [V4+ Styles] section, plus the [Events] line and
2759 * - decoding: unused.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())
2760 */2781 */
2761 uint64_t vbv_delay;2782 uint8_t *subtitle_header;
2783 int subtitle_header_size;
2762 2784
2763 /**2785 /**
2764 * Type of service that the audio stream conveys.2786 * Simulates errors in the bitstream to test error concealment.
2765 * - encoding: Set by user.2787 * - encoding: Set by user.
2766 * - decoding: Set by libavcodec.2788 * - decoding: unused
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.
2775 */2789 */
2776 enum AVSampleFormat request_sample_fmt;2790 int error_rate;
2777 2791
2778 /**2792 /**
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
2780 * - encoding: unused2797 * - encoding: unused
2781 * - decoding: Set by user.
2782 */2798 */
2783 int err_recognition;2799 AVPacket *pkt;
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)
2792 2800
2793 /**2801 /**
2794 * Private context used for internal data.2802 * VBV delay coded in the last frame (in periods of a 27 MHz clock).
2795 *2803 * Used for compliant TS muxing.
2796 * Unlike priv_data, this is not codec-specific. It is used in general2804 * - encoding: Set by libavcodec.
2797 * libavcodec functions.2805 * - decoding: unused.
2798 */
2799 struct AVCodecInternal *internal;
2800
2801 /** Field order
2802 * - encoding: set by libavcodec
2803 * - decoding: Set by libavcodec
2804 */2806 */
2805 enum AVFieldOrder field_order;2807 uint64_t vbv_delay;
2806 2808
2807 /**2809 /**
2808 * Current statistics for PTS correction.2810 * Current statistics for PTS correction.
@@ -2813,7 +2815,6 @@ typedef struct AVCodecContext { · 4 unmodified lines
2813 int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far2815 int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
2814 int64_t pts_correction_last_pts; /// PTS of the last frame2816 int64_t pts_correction_last_pts; /// PTS of the last frame
2815 int64_t pts_correction_last_dts; /// DTS of the last frame2817 int64_t pts_correction_last_dts; /// DTS of the last frame
2816
2817} AVCodecContext;2818} AVCodecContext;
2818 2819
2819/**2820/**
libavcodec/pthread.c+1−1
@@ -480,7 +480,7 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src) · 479 unmodified lines
480 dst->slice_flags = src->slice_flags;480 dst->slice_flags = src->slice_flags;
481 dst->flags2 = src->flags2;481 dst->flags2 = src->flags2;
482 482
483 copy_fields(skip_loop_filter, bidir_refine);483 copy_fields(skip_loop_filter, subtitle_header);
484 484
485 dst->frame_number = src->frame_number;485 dst->frame_number = src->frame_number;
486 dst->reordered_opaque = src->reordered_opaque;486 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
603 return s->get_buffer(s, pic);603 return s->get_buffer(s, pic);
604 }604 }
605 605
606 assert(s->pix_fmt == pic->pix_fmt);606 assert(s->pix_fmt == pic->format);
607 607
608 /* If internal buffer type return the same buffer */608 /* If internal buffer type return the same buffer */
609 if(pic->type == FF_BUFFER_TYPE_INTERNAL) {609 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
876%if mmsize < 16876%if mmsize < 16
877 add r0, mmsize877 add r0, mmsize
878 add r5, mmsize878 add r5, mmsize
879 add r4, mmsize/8879 add r4, mmsize/4
880 dec r6880 dec r6
881 jg .loop881 jg .loop
882 REP_RET882 REP_RET
libavformat/flvdec.c+50−10
@@ -35,12 +35,20 @@ · 34 unmodified lines
35#include "avio_internal.h"35#include "avio_internal.h"
36#include "flv.h"36#include "flv.h"
37 37
38#define VALIDATE_INDEX_TS_THRESH 2500
39
38typedef struct {40typedef struct {
39 int wrong_dts; ///< wrong dts due to negative cts41 int wrong_dts; ///< wrong dts due to negative cts
40 uint8_t *new_extradata[FLV_STREAM_TYPE_NB];42 uint8_t *new_extradata[FLV_STREAM_TYPE_NB];
41 int new_extradata_size[FLV_STREAM_TYPE_NB];43 int new_extradata_size[FLV_STREAM_TYPE_NB];
42 int last_sample_rate;44 int last_sample_rate;
43 int last_channels;45 int last_channels;
46 struct {
47 int64_t dts;
48 int64_t pos;
49 } validate_index[2];
50 int validate_next;
51 int validate_count;
44} FLVContext;52} FLVContext;
45 53
46static int flv_probe(AVProbeData *p)54static int flv_probe(AVProbeData *p)
@@ -137,6 +145,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { · 90 unmodified lines
137}145}
138 146
139static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {147static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
148 FLVContext *flv = s->priv_data;
140 unsigned int timeslen = 0, fileposlen = 0, i;149 unsigned int timeslen = 0, fileposlen = 0, i;
141 char str_val[256];150 char str_val[256];
142 int64_t *times = NULL;151 int64_t *times = NULL;
@@ -192,18 +201,15 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream · 49 unmodified lines
192 }201 }
193 202
194 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {203 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {
195 int64_t av_unused dts, size0, size1;204 for (i = 0; i < fileposlen; i++) {
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++)
205 av_add_index_entry(vstream, filepositions[i], times[i]*1000,205 av_add_index_entry(vstream, filepositions[i], times[i]*1000,
206 0, 0, AVINDEX_KEYFRAME);206 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 }
207 } else {213 } else {
208invalid:214invalid:
209 av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");215 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
444 return 0;450 return 0;
445}451}
446 452
453static 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
447static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)469static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
448{470{
449 FLVContext *flv = s->priv_data;471 FLVContext *flv = s->priv_data;
@@ -467,6 +489,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 17 unmodified lines
467 avio_skip(s->pb, 3); /* stream id, always 0 */489 avio_skip(s->pb, 3); /* stream id, always 0 */
468 flags = 0;490 flags = 0;
469 491
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
470 if(size == 0)508 if(size == 0)
471 continue;509 continue;
472 510
@@ -654,6 +692,8 @@ leave: · 181 unmodified lines
654static int flv_read_seek(AVFormatContext *s, int stream_index,692static int flv_read_seek(AVFormatContext *s, int stream_index,
655 int64_t ts, int flags)693 int64_t ts, int flags)
656{694{
695 FLVContext *flv = s->priv_data;
696 flv->validate_count = 0;
657 return avio_seek_time(s->pb, stream_index, ts, flags);697 return avio_seek_time(s->pb, stream_index, ts, flags);
658}698}
659 699
libavformat/movenc.c+41−13
@@ -565,6 +565,42 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) · 564 unmodified lines
565 }565 }
566}566}
567 567
568static 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
583static 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
568static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)604static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
569{605{
570 int64_t pos = avio_tell(pb);606 int64_t pos = avio_tell(pb);
@@ -607,7 +643,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) · 36 unmodified lines
607 avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));643 avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
608 avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));644 avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));
609 avio_wb32(pb, track->sample_size);645 avio_wb32(pb, track->sample_size);
610 avio_wb32(pb, track->enc->frame_size);646 avio_wb32(pb, get_samples_per_packet(track));
611 } else {647 } else {
612 if (track->mode == MODE_MOV) {648 if (track->mode == MODE_MOV) {
613 avio_wb16(pb, track->enc->channels);649 avio_wb16(pb, track->enc->channels);
@@ -1143,9 +1179,7 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) · 529 unmodified lines
1143 av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */1179 av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */
1144 NULL;1180 NULL;
1145 for (i=0; i<track->entry; i++) {1181 for (i=0; i<track->entry; i++) {
1146 int64_t duration = i + 1 == track->entry ?1182 int duration = get_cluster_duration(track, i);
1147 track->track_duration - track->cluster[i].dts + track->start_dts : /* readjusting */
1148 track->cluster[i+1].dts - track->cluster[i].dts;
1149 if (i && duration == stts_entries[entries].duration) {1183 if (i && duration == stts_entries[entries].duration) {
1150 stts_entries[entries].count++; /* compress */1184 stts_entries[entries].count++; /* compress */
1151 } else {1185 } else {
@@ -2262,7 +2296,7 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track, · 1110 unmodified lines
2262 if (flags & MOV_TFHD_BASE_DATA_OFFSET)2296 if (flags & MOV_TFHD_BASE_DATA_OFFSET)
2263 avio_wb64(pb, moof_offset);2297 avio_wb64(pb, moof_offset);
2264 if (flags & MOV_TFHD_DEFAULT_DURATION) {2298 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);
2266 avio_wb32(pb, track->default_duration);2300 avio_wb32(pb, track->default_duration);
2267 }2301 }
2268 if (flags & MOV_TFHD_DEFAULT_SIZE) {2302 if (flags & MOV_TFHD_DEFAULT_SIZE) {
@@ -2295,10 +2329,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track) · 26 unmodified lines
2295 int i;2329 int i;
2296 2330
2297 for (i = 0; i < track->entry; i++) {2331 for (i = 0; i < track->entry; i++) {
2298 int64_t duration = i + 1 == track->entry ?2332 if (get_cluster_duration(track, i) != track->default_duration)
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)
2302 flags |= MOV_TRUN_SAMPLE_DURATION;2333 flags |= MOV_TRUN_SAMPLE_DURATION;
2303 if (track->cluster[i].size != track->default_size)2334 if (track->cluster[i].size != track->default_size)
2304 flags |= MOV_TRUN_SAMPLE_SIZE;2335 flags |= MOV_TRUN_SAMPLE_SIZE;
@@ -2322,11 +2353,8 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track) · 17 unmodified lines
2322 avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));2353 avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
2323 2354
2324 for (i = 0; i < track->entry; i++) {2355 for (i = 0; i < track->entry; i++) {
2325 int64_t duration = i + 1 == track->entry ?
2326 track->track_duration - track->cluster[i].dts + track->start_dts :
2327 track->cluster[i + 1].dts - track->cluster[i].dts;
2328 if (flags & MOV_TRUN_SAMPLE_DURATION)2356 if (flags & MOV_TRUN_SAMPLE_DURATION)
2329 avio_wb32(pb, duration);2357 avio_wb32(pb, get_cluster_duration(track, i));
2330 if (flags & MOV_TRUN_SAMPLE_SIZE)2358 if (flags & MOV_TRUN_SAMPLE_SIZE)
2331 avio_wb32(pb, track->cluster[i].size);2359 avio_wb32(pb, track->cluster[i].size);
2332 if (flags & MOV_TRUN_SAMPLE_FLAGS)2360 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
900 char buf[4096], buf1[1024], *q;900 char buf[4096], buf1[1024], *q;
901 unsigned char ch;901 unsigned char ch;
902 const char *p;902 const char *p;
903 int ret, content_length, line_count = 0;903 int ret, content_length, line_count = 0, request = 0;
904 unsigned char *content = NULL;904 unsigned char *content = NULL;
905 905
906start:
907 line_count = 0;
908 request = 0;
909 content = NULL;
906 memset(reply, 0, sizeof(*reply));910 memset(reply, 0, sizeof(*reply));
907 911
908 /* parse reply (XXX: use buffers) */912 /* parse reply (XXX: use buffers) */
@@ -938,9 +942,15 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 29 unmodified lines
938 if (line_count == 0) {942 if (line_count == 0) {
939 /* get reply code */943 /* get reply code */
940 get_word(buf1, sizeof(buf1), &p);944 get_word(buf1, sizeof(buf1), &p);
941 get_word(buf1, sizeof(buf1), &p);945 if (!strncmp(buf1, "RTSP/", 5)) {
942 reply->status_code = atoi(buf1);946 get_word(buf1, sizeof(buf1), &p);
943 av_strlcpy(reply->reason, p, sizeof(reply->reason));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 }
944 } else {954 } else {
945 ff_rtsp_parse_line(reply, p, rt, method);955 ff_rtsp_parse_line(reply, p, rt, method);
946 av_strlcat(rt->last_reply, p, sizeof(rt->last_reply));956 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
949 line_count++;959 line_count++;
950 }960 }
951 961
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)
953 av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));963 av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));
954 964
955 content_length = reply->content_length;965 content_length = reply->content_length;
@@ -964,6 +974,44 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, · 8 unmodified lines
964 else974 else
965 av_free(content);975 av_free(content);
966 976
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
967 if (rt->seq != reply->seq) {1015 if (rt->seq != reply->seq) {
968 av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",1016 av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",
969 rt->seq, reply->seq);1017 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
15 15
16FATE_TESTS += $(FATE_LOSSLESS_AUDIO)16FATE_TESTS += $(FATE_LOSSLESS_AUDIO)
17fate-lossless-audio: $(FATE_LOSSLESS_AUDIO)17fate-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