#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
-#include "avcodec.h"
+
#include "bytestream.h"
#include "internal.h"
+#include "packet.h"
void av_init_packet(AVPacket *pkt)
{
if (!pkt)
return pkt;
- av_packet_unref(pkt);
+ av_init_packet(pkt);
return pkt;
}
case AV_PKT_DATA_ENCRYPTION_INIT_INFO: return "Encryption initialization data";
case AV_PKT_DATA_ENCRYPTION_INFO: return "Encryption info";
case AV_PKT_DATA_AFD: return "Active Format Description data";
+ case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile";
+ case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record";
}
return NULL;
}
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
{
- const uint8_t *end = data + size;
- int ret = 0;
+ const uint8_t *end;
+ int ret;
if (!dict || !data || !size)
- return ret;
+ return 0;
+ end = data + size;
if (size && end[-1])
return AVERROR_INVALIDDATA;
while (data < end) {
ret = av_dict_set(dict, key, val, 0);
if (ret < 0)
- break;
+ return ret;
data = val + strlen(val) + 1;
}
- return ret;
+ return 0;
}
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
{
int ret;
+ dst->buf = NULL;
+
ret = av_packet_copy_props(dst, src);
if (ret < 0)
- return ret;
+ goto fail;
if (!src->buf) {
ret = packet_alloc(&dst->buf, src->size);
return 0;
fail:
- av_packet_free_side_data(dst);
+ av_packet_unref(dst);
return ret;
}
return 0;
}
+
+int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
+{
+ AVProducerReferenceTime *prft;
+ uint8_t *side_data;
+ int side_data_size;
+
+ side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
+ if (!side_data) {
+ side_data_size = sizeof(AVProducerReferenceTime);
+ side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT, side_data_size);
+ }
+
+ if (!side_data || side_data_size < sizeof(AVProducerReferenceTime))
+ return AVERROR(ENOMEM);
+
+ prft = (AVProducerReferenceTime *)side_data;
+ prft->wallclock = timestamp;
+ prft->flags = 0;
+
+ return 0;
+}