History

lavc: add a packet side data type for VBV-like parameters

Anton Khirnov committed 11 years ago

Commit f0b769c1 parent e63e3793 files · +69 −0Browse files

Unified · Split

3 files
  1. doc/APIchanges +1 −0
  2. libavcodec/avcodec.h +54 −0
  3. libavcodec/utils.c +14 −0
doc/APIchanges+1−0
@@ -16,6 +16,7 @@ API changes, most recent first: · 15 unmodified lines
162015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h162015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h
17 xxxxxxx - Add av_packet_add_side_data().17 xxxxxxx - Add av_packet_add_side_data().
18 xxxxxxx - Add AVCodecContext.coded_side_data.18 xxxxxxx - Add AVCodecContext.coded_side_data.
19 xxxxxxx - Add AVCPBProperties API.
19 20
202015-xx-xx - xxxxxxx - lavc 57.9.1 - avcodec.h212015-xx-xx - xxxxxxx - lavc 57.9.1 - avcodec.h
21 Deprecate rtp_callback without replacement, i.e. it won't be possible to22 Deprecate rtp_callback without replacement, i.e. it won't be possible to
libavcodec/avcodec.h+54−0
@@ -1036,6 +1036,44 @@ typedef struct AVPanScan{ · 1035 unmodified lines
1036 int16_t position[3][2];1036 int16_t position[3][2];
1037}AVPanScan;1037}AVPanScan;
1038 1038
1039/**
1040 * This structure describes the bitrate properties of an encoded bitstream. It
1041 * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1042 * parameters for H.264/HEVC.
1043 */
1044typedef struct AVCPBProperties {
1045 /**
1046 * Maximum bitrate of the stream, in bits per second.
1047 * Zero if unknown or unspecified.
1048 */
1049 int max_bitrate;
1050 /**
1051 * Minimum bitrate of the stream, in bits per second.
1052 * Zero if unknown or unspecified.
1053 */
1054 int min_bitrate;
1055 /**
1056 * Average bitrate of the stream, in bits per second.
1057 * Zero if unknown or unspecified.
1058 */
1059 int avg_bitrate;
1060
1061 /**
1062 * The size of the buffer to which the ratecontrol is applied, in bits.
1063 * Zero if unknown or unspecified.
1064 */
1065 int buffer_size;
1066
1067 /**
1068 * The delay between the time the packet this structure is associated with
1069 * is received and the time when it should be decoded, in periods of a 27MHz
1070 * clock.
1071 *
1072 * UINT64_MAX when unknown or unspecified.
1073 */
1074 uint64_t vbv_delay;
1075} AVCPBProperties;
1076
1039#if FF_API_QSCALE_TYPE1077#if FF_API_QSCALE_TYPE
1040#define FF_QSCALE_TYPE_MPEG1 01078#define FF_QSCALE_TYPE_MPEG1 0
1041#define FF_QSCALE_TYPE_MPEG2 11079#define FF_QSCALE_TYPE_MPEG2 1
@@ -1137,6 +1175,11 @@ enum AVPacketSideDataType { · 95 unmodified lines
1137 * e.g. no decoder available for codec.1175 * e.g. no decoder available for codec.
1138 */1176 */
1139 AV_PKT_DATA_FALLBACK_TRACK,1177 AV_PKT_DATA_FALLBACK_TRACK,
1178
1179 /**
1180 * This side data corresponds to the AVCPBProperties struct.
1181 */
1182 AV_PKT_DATA_CPB_PROPERTIES,
1140};1183};
1141 1184
1142typedef struct AVPacketSideData {1185typedef struct AVPacketSideData {
@@ -4630,6 +4673,17 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); · 3487 unmodified lines
4630 */4673 */
4631const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);4674const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
4632 4675
4676/**
4677 * Allocate a CPB properties structure and initialize its fields to default
4678 * values.
4679 *
4680 * @param size if non-NULL, the size of the allocated struct will be written
4681 * here. This is useful for embedding it in side data.
4682 *
4683 * @return the newly allocated struct or NULL on failure
4684 */
4685AVCPBProperties *av_cpb_properties_alloc(size_t *size);
4686
4633/**4687/**
4634 * @}4688 * @}
4635 */4689 */
libavcodec/utils.c+14−0
@@ -2369,3 +2369,17 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p, · 2368 unmodified lines
2369 2369
2370 return p + 4;2370 return p + 4;
2371}2371}
2372
2373AVCPBProperties *av_cpb_properties_alloc(size_t *size)
2374{
2375 AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
2376 if (!props)
2377 return NULL;
2378
2379 if (size)
2380 *size = sizeof(*props);
2381
2382 props->vbv_delay = UINT64_MAX;
2383
2384 return props;
2385}

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