Deprecated in 10/2012.
Unified · Split
| @@ -1209,12 +1209,7 @@ typedef struct AVPacket { · 1208 unmodified lines | ||
| 1209 | 1209 | * Equals next_pts - this_pts in presentation order. |
| 1210 | 1210 | */ |
| 1211 | 1211 | int duration; |
| 1212 | −#if FF_API_DESTRUCT_PACKET | |
| 1213 | − attribute_deprecated | |
| 1214 | − void (*destruct)(struct AVPacket *); | |
| 1215 | − attribute_deprecated | |
| 1216 | − void *priv; | |
| 1217 | −#endif | |
| 1212 | + | |
| 1218 | 1213 | int64_t pos; ///< byte position in stream, -1 if unknown |
| 1219 | 1214 | |
| 1220 | 1215 | /** |
| @@ -3576,15 +3571,6 @@ void avsubtitle_free(AVSubtitle *sub); · 2355 unmodified lines | ||
| 3576 | 3571 | * @{ |
| 3577 | 3572 | */ |
| 3578 | 3573 | |
| 3579 | −#if FF_API_DESTRUCT_PACKET | |
| 3580 | −/** | |
| 3581 | − * Default packet destructor. | |
| 3582 | − * @deprecated use the AVBuffer API instead | |
| 3583 | − */ | |
| 3584 | −attribute_deprecated | |
| 3585 | −void av_destruct_packet(AVPacket *pkt); | |
| 3586 | −#endif | |
| 3587 | − | |
| 3588 | 3574 | /** |
| 3589 | 3575 | * Initialize optional fields of a packet with default values. |
| 3590 | 3576 | * |
| @@ -27,22 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | #include "libavutil/mathematics.h" |
| 28 | 28 | #include "libavutil/mem.h" |
| 29 | 29 | #include "avcodec.h" |
| 30 | −#if FF_API_DESTRUCT_PACKET | |
| 31 | − | |
| 32 | −void av_destruct_packet(AVPacket *pkt) | |
| 33 | −{ | |
| 34 | − av_free(pkt->data); | |
| 35 | − pkt->data = NULL; | |
| 36 | − pkt->size = 0; | |
| 37 | −} | |
| 38 | − | |
| 39 | −/* a dummy destruct callback for the callers that assume AVPacket.destruct == | |
| 40 | − * NULL => static data */ | |
| 41 | −static void dummy_destruct_packet(AVPacket *pkt) | |
| 42 | −{ | |
| 43 | − av_assert0(0); | |
| 44 | −} | |
| 45 | −#endif | |
| 46 | 30 | |
| 47 | 31 | void av_init_packet(AVPacket *pkt) |
| 48 | 32 | { |
| @@ -53,11 +37,6 @@ void av_init_packet(AVPacket *pkt) · 4 unmodified lines | ||
| 53 | 37 | pkt->convergence_duration = 0; |
| 54 | 38 | pkt->flags = 0; |
| 55 | 39 | pkt->stream_index = 0; |
| 56 | −#if FF_API_DESTRUCT_PACKET | |
| 57 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 58 | − pkt->destruct = NULL; | |
| 59 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 60 | −#endif | |
| 61 | 40 | pkt->buf = NULL; |
| 62 | 41 | pkt->side_data = NULL; |
| 63 | 42 | pkt->side_data_elems = 0; |
| @@ -89,11 +68,6 @@ int av_new_packet(AVPacket *pkt, int size) · 25 unmodified lines | ||
| 89 | 68 | pkt->buf = buf; |
| 90 | 69 | pkt->data = buf->data; |
| 91 | 70 | pkt->size = size; |
| 92 | −#if FF_API_DESTRUCT_PACKET | |
| 93 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 94 | − pkt->destruct = dummy_destruct_packet; | |
| 95 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 96 | −#endif | |
| 97 | 71 | |
| 98 | 72 | return 0; |
| 99 | 73 | } |
| @@ -126,11 +100,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by) · 26 unmodified lines | ||
| 126 | 100 | if (!pkt->buf) |
| 127 | 101 | return AVERROR(ENOMEM); |
| 128 | 102 | memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size + grow_by)); |
| 129 | −#if FF_API_DESTRUCT_PACKET | |
| 130 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 131 | − pkt->destruct = dummy_destruct_packet; | |
| 132 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 133 | −#endif | |
| 134 | 103 | } |
| 135 | 104 | pkt->data = pkt->buf->data; |
| 136 | 105 | pkt->size += grow_by; |
| @@ -151,11 +120,6 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size) · 14 unmodified lines | ||
| 151 | 120 | |
| 152 | 121 | pkt->data = data; |
| 153 | 122 | pkt->size = size; |
| 154 | −#if FF_API_DESTRUCT_PACKET | |
| 155 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 156 | − pkt->destruct = dummy_destruct_packet; | |
| 157 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 158 | −#endif | |
| 159 | 123 | |
| 160 | 124 | return 0; |
| 161 | 125 | } |
| @@ -191,23 +155,12 @@ int av_dup_packet(AVPacket *pkt) · 29 unmodified lines | ||
| 191 | 155 | { |
| 192 | 156 | AVPacket tmp_pkt; |
| 193 | 157 | |
| 194 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 195 | − if (!pkt->buf && pkt->data | |
| 196 | −#if FF_API_DESTRUCT_PACKET | |
| 197 | − && !pkt->destruct | |
| 198 | −#endif | |
| 199 | − ) { | |
| 200 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 158 | + if (!pkt->buf && pkt->data) { | |
| 201 | 159 | tmp_pkt = *pkt; |
| 202 | 160 | |
| 203 | 161 | pkt->data = NULL; |
| 204 | 162 | pkt->side_data = NULL; |
| 205 | 163 | DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1, ALLOC_BUF); |
| 206 | −#if FF_API_DESTRUCT_PACKET | |
| 207 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 208 | − pkt->destruct = dummy_destruct_packet; | |
| 209 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 210 | −#endif | |
| 211 | 164 | |
| 212 | 165 | if (pkt->side_data_elems) { |
| 213 | 166 | int i; |
| @@ -243,15 +196,8 @@ void av_packet_free_side_data(AVPacket *pkt) · 29 unmodified lines | ||
| 243 | 196 | void av_free_packet(AVPacket *pkt) |
| 244 | 197 | { |
| 245 | 198 | if (pkt) { |
| 246 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 247 | 199 | if (pkt->buf) |
| 248 | 200 | av_buffer_unref(&pkt->buf); |
| 249 | −#if FF_API_DESTRUCT_PACKET | |
| 250 | − else if (pkt->destruct) | |
| 251 | − pkt->destruct(pkt); | |
| 252 | − pkt->destruct = NULL; | |
| 253 | −#endif | |
| 254 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 255 | 201 | pkt->data = NULL; |
| 256 | 202 | pkt->size = 0; |
| 257 | 203 | |
| @@ -1329,21 +1329,11 @@ int ff_alloc_packet(AVPacket *avpkt, int size) · 1328 unmodified lines | ||
| 1329 | 1329 | |
| 1330 | 1330 | if (avpkt->data) { |
| 1331 | 1331 | AVBufferRef *buf = avpkt->buf; |
| 1332 | −#if FF_API_DESTRUCT_PACKET | |
| 1333 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 1334 | − void *destruct = avpkt->destruct; | |
| 1335 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 1336 | −#endif | |
| 1337 | 1332 | |
| 1338 | 1333 | if (avpkt->size < size) |
| 1339 | 1334 | return AVERROR(EINVAL); |
| 1340 | 1335 | |
| 1341 | 1336 | av_init_packet(avpkt); |
| 1342 | −#if FF_API_DESTRUCT_PACKET | |
| 1343 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 1344 | − avpkt->destruct = destruct; | |
| 1345 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 1346 | −#endif | |
| 1347 | 1337 | avpkt->buf = buf; |
| 1348 | 1338 | avpkt->size = size; |
| 1349 | 1339 | return 0; |
| @@ -51,9 +51,6 @@ · 50 unmodified lines | ||
| 51 | 51 | #ifndef FF_API_DEINTERLACE |
| 52 | 52 | #define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57) |
| 53 | 53 | #endif |
| 54 | −#ifndef FF_API_DESTRUCT_PACKET | |
| 55 | −#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 57) | |
| 56 | −#endif | |
| 57 | 54 | #ifndef FF_API_GET_BUFFER |
| 58 | 55 | #define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57) |
| 59 | 56 | #endif |
| @@ -421,13 +421,6 @@ static int mmap_init(AVFormatContext *ctx) · 420 unmodified lines | ||
| 421 | 421 | return 0; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | −#if FF_API_DESTRUCT_PACKET | |
| 425 | −static void dummy_release_buffer(AVPacket *pkt) | |
| 426 | −{ | |
| 427 | − av_assert0(0); | |
| 428 | −} | |
| 429 | −#endif | |
| 430 | − | |
| 431 | 424 | static void mmap_release_buffer(void *opaque, uint8_t *data) |
| 432 | 425 | { |
| 433 | 426 | struct v4l2_buffer buf = { 0 }; |
| @@ -524,11 +517,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt) · 90 unmodified lines | ||
| 524 | 517 | |
| 525 | 518 | pkt->data = s->buf_start[buf.index]; |
| 526 | 519 | pkt->size = buf.bytesused; |
| 527 | −#if FF_API_DESTRUCT_PACKET | |
| 528 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 529 | − pkt->destruct = dummy_release_buffer; | |
| 530 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 531 | −#endif | |
| 532 | 520 | |
| 533 | 521 | buf_descriptor = av_malloc(sizeof(struct buff_data)); |
| 534 | 522 | if (!buf_descriptor) { |
| @@ -1095,9 +1095,6 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) · 1094 unmodified lines | ||
| 1095 | 1095 | AVIContext *avi = s->priv_data; |
| 1096 | 1096 | AVIOContext *pb = s->pb; |
| 1097 | 1097 | int err; |
| 1098 | −#if FF_API_DESTRUCT_PACKET | |
| 1099 | − void *dstr; | |
| 1100 | −#endif | |
| 1101 | 1098 | |
| 1102 | 1099 | if (CONFIG_DV_DEMUXER && avi->dv_demux) { |
| 1103 | 1100 | int size = avpriv_dv_get_packet(avi->dv_demux, pkt); |
| @@ -1213,18 +1210,8 @@ resync: · 109 unmodified lines | ||
| 1213 | 1210 | |
| 1214 | 1211 | if (CONFIG_DV_DEMUXER && avi->dv_demux) { |
| 1215 | 1212 | AVBufferRef *avbuf = pkt->buf; |
| 1216 | −#if FF_API_DESTRUCT_PACKET | |
| 1217 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 1218 | − dstr = pkt->destruct; | |
| 1219 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 1220 | −#endif | |
| 1221 | 1213 | size = avpriv_dv_produce_packet(avi->dv_demux, pkt, |
| 1222 | 1214 | pkt->data, pkt->size); |
| 1223 | −#if FF_API_DESTRUCT_PACKET | |
| 1224 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 1225 | − pkt->destruct = dstr; | |
| 1226 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 1227 | −#endif | |
| 1228 | 1215 | pkt->buf = avbuf; |
| 1229 | 1216 | pkt->flags |= AV_PKT_FLAG_KEY; |
| 1230 | 1217 | if (size < 0) |
| @@ -413,11 +413,6 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, · 412 unmodified lines | ||
| 413 | 413 | if (!this_pktl) |
| 414 | 414 | return AVERROR(ENOMEM); |
| 415 | 415 | this_pktl->pkt = *pkt; |
| 416 | −#if FF_API_DESTRUCT_PACKET | |
| 417 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 418 | − pkt->destruct = NULL; // do not free original but only the copy | |
| 419 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 420 | −#endif | |
| 421 | 416 | pkt->buf = NULL; |
| 422 | 417 | pkt->side_data = NULL; |
| 423 | 418 | pkt->side_data_elems = 0; |
| @@ -169,11 +169,6 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 168 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | pkt->pts = pkt->dts = mxg->dts; |
| 171 | 171 | pkt->stream_index = 0; |
| 172 | −#if FF_API_DESTRUCT_PACKET | |
| 173 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 174 | − pkt->destruct = NULL; | |
| 175 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 176 | −#endif | |
| 177 | 172 | pkt->buf = NULL; |
| 178 | 173 | pkt->size = mxg->buffer_ptr - mxg->soi_ptr; |
| 179 | 174 | pkt->data = mxg->soi_ptr; |
| @@ -212,11 +207,6 @@ FF_ENABLE_DEPRECATION_WARNINGS · 32 unmodified lines | ||
| 212 | 207 | /* time (GMT) of first sample in usec since 1970, little-endian */ |
| 213 | 208 | pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); |
| 214 | 209 | pkt->stream_index = 1; |
| 215 | −#if FF_API_DESTRUCT_PACKET | |
| 216 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 217 | − pkt->destruct = NULL; | |
| 218 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 219 | −#endif | |
| 220 | 210 | pkt->buf = NULL; |
| 221 | 211 | pkt->size = size - 14; |
| 222 | 212 | pkt->data = startmarker_ptr + 16; |
| @@ -203,11 +203,6 @@ static int str_read_packet(AVFormatContext *s, · 202 unmodified lines | ||
| 203 | 203 | pkt->data= NULL; |
| 204 | 204 | pkt->size= -1; |
| 205 | 205 | pkt->buf = NULL; |
| 206 | −#if FF_API_DESTRUCT_PACKET | |
| 207 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 208 | − pkt->destruct = NULL; | |
| 209 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 210 | −#endif | |
| 211 | 206 | return 0; |
| 212 | 207 | } |
| 213 | 208 | |
| @@ -687,11 +687,6 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 686 unmodified lines | ||
| 687 | 687 | vst->pkt.data= NULL; |
| 688 | 688 | vst->pkt.size= 0; |
| 689 | 689 | vst->pkt.buf = NULL; |
| 690 | −#if FF_API_DESTRUCT_PACKET | |
| 691 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 692 | − vst->pkt.destruct = NULL; | |
| 693 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 694 | −#endif | |
| 695 | 690 | if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin |
| 696 | 691 | memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices, |
| 697 | 692 | vst->videobufpos - 1 - 8*vst->slices); |
| @@ -828,12 +828,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) · 827 unmodified lines | ||
| 828 | 828 | if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) { |
| 829 | 829 | out_pkt.buf = pkt->buf; |
| 830 | 830 | pkt->buf = NULL; |
| 831 | −#if FF_API_DESTRUCT_PACKET | |
| 832 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 833 | − out_pkt.destruct = pkt->destruct; | |
| 834 | − pkt->destruct = NULL; | |
| 835 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 836 | −#endif | |
| 837 | 831 | } |
| 838 | 832 | if ((ret = av_dup_packet(&out_pkt)) < 0) |
| 839 | 833 | goto fail; |
| @@ -127,11 +127,6 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) · 126 unmodified lines | ||
| 127 | 127 | *pkt = yop->video_packet; |
| 128 | 128 | yop->video_packet.data = NULL; |
| 129 | 129 | yop->video_packet.buf = NULL; |
| 130 | −#if FF_API_DESTRUCT_PACKET | |
| 131 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 132 | − yop->video_packet.destruct = NULL; | |
| 133 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 134 | −#endif | |
| 135 | 130 | yop->video_packet.size = 0; |
| 136 | 131 | pkt->data[0] = yop->odd_frame; |
| 137 | 132 | pkt->flags |= AV_PKT_FLAG_KEY; |