From 1afddbe59e96af75f1c07605afc95615569f388f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 31 Oct 2012 08:53:18 +0100 Subject: avpacket: use AVBuffer to allow refcounting the packets. This will allow us to avoid copying the packets in many cases. This breaks ABI. --- libavformat/matroskadec.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libavformat/matroskadec.c') diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 86ff477d85..a01e2c4f57 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1107,7 +1107,8 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size, static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, AVPacket *pkt, uint64_t display_duration) { - char *line, *layer, *ptr = pkt->data, *end = ptr+pkt->size; + AVBufferRef *line; + char *layer, *ptr = pkt->data, *end = ptr+pkt->size; for (; *ptr!=',' && ptrdata, len,"Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s\r\n", layer, sh, sm, ss, sc, eh, em, es, ec, ptr); - av_free(pkt->data); - pkt->data = line; - pkt->size = strlen(line); + av_buffer_unref(&pkt->buf); + pkt->buf = line; + pkt->data = line->data; + pkt->size = strlen(line->data); } } -- cgit v1.2.3