API changes, most recent first:
-2015-xx-xx - lavc 57.7.0 - avcodec.h
++2015-10-29 - lavc 57.12.100 / 57.8.0 - avcodec.h
+ xxxxxx - Deprecate av_free_packet(). Use av_packet_unref() as replacement,
+ it resets the packet in a more consistent way.
+ xxxxxx - Deprecate av_dup_packet(), it is a no-op for most cases.
+ Use av_packet_ref() to make a non-refcounted AVPacket refcounted.
+
-2015-xx-xx - xxxxxxx - lavc 57.5.0 - avcodec.h
+2015-10-27 - xxxxxxx - lavu 55.5.100 - cpu.h
+ Add AV_CPU_FLAG_AESNI.
+
- 2015-10-27 - xxxxxxx - lavc 57.12.100 / 57.8.0 - avcodec.h
- Deprecate av_free_packet(). Use av_packet_unref() as replacement,
- it resets the packet in a more consistent way.
-
+2015-10-22 - xxxxxxx - lavc 57.9.100 / lavc 57.5.0 - avcodec.h
Add data and linesize array to AVSubtitleRect, to be used instead of
the ones from the embedded AVPicture.
/**
* @warning This is a hack - the packet memory allocation stuff is broken. The
* packet is allocated if it was not really allocated.
+ *
+ * @deprecated Use av_packet_ref
*/
+ attribute_deprecated
int av_dup_packet(AVPacket *pkt);
- #if FF_API_AVPACKET_OLD_API
/**
+ * Copy packet, including contents
+ *
+ * @return 0 on success, negative AVERROR on fail
+ */
+int av_copy_packet(AVPacket *dst, const AVPacket *src);
+
+/**
+ * Copy packet side data
+ *
+ * @return 0 on success, negative AVERROR on fail
+ */
+int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
+
+/**
* Free a packet.
*
* @deprecated Use av_packet_unref
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
+ FF_ENABLE_DEPRECATION_WARNINGS
+ #endif
+int av_dup_packet(AVPacket *pkt)
+{
+ AVPacket tmp_pkt;
+
+ if (!pkt->buf && pkt->data) {
+ tmp_pkt = *pkt;
+ return copy_packet_data(pkt, &tmp_pkt, 1);
+ }
+ return 0;
+}
+
+int av_copy_packet(AVPacket *dst, const AVPacket *src)
+{
+ *dst = *src;
+ return copy_packet_data(dst, src, 0);
+}
+
void av_packet_free_side_data(AVPacket *pkt)
{
int i;
// buffer an audio packet to ensure the packet containing the video
// keyframe's timecode is contained in the same cluster for WebM
if (codec_type == AVMEDIA_TYPE_AUDIO) {
- mkv->cur_audio_pkt = *pkt;
- if (pkt->buf) {
- mkv->cur_audio_pkt.buf = av_buffer_ref(pkt->buf);
- ret = mkv->cur_audio_pkt.buf ? 0 : AVERROR(ENOMEM);
- } else
- ret = av_dup_packet(&mkv->cur_audio_pkt);
- if (mkv->cur_audio_pkt.side_data_elems > 0) {
- ret = av_copy_packet_side_data(&mkv->cur_audio_pkt, &mkv->cur_audio_pkt);
- }
+ ret = av_packet_ref(&mkv->cur_audio_pkt, pkt);
} else
- ret = mkv_write_packet_internal(s, pkt);
+ ret = mkv_write_packet_internal(s, pkt, 0);
return ret;
}
this_pktl = av_mallocz(sizeof(AVPacketList));
if (!this_pktl)
return AVERROR(ENOMEM);
- this_pktl->pkt = *pkt;
- pkt->buf = NULL;
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
+ if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {
+ av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE);
+ av_assert0(((AVFrame *)pkt->data)->buf);
- } else {
- // Duplicate the packet if it uses non-allocated memory
- if ((ret = av_dup_packet(&this_pktl->pkt)) < 0) {
- av_free(this_pktl);
- return ret;
- }
++ }
+
+ if ((ret = av_packet_ref(&this_pktl->pkt, pkt)) < 0) {
+ av_free(this_pktl);
+ return ret;
}
if (s->streams[pkt->stream_index]->last_in_packet_buffer) {