summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-08 17:28:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-08 19:12:03 +0100
commit2653e125204569b1e9439ee2671c6ebb23a94b80 (patch)
tree4176f76bccc8cdd1c85b9d329a82867eda37d397 /libavformat/matroskadec.c
parent532f31a695c9530ce67a847be00d72e6e8acfd11 (diff)
parent1afddbe59e96af75f1c07605afc95615569f388f (diff)
Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f': avpacket: use AVBuffer to allow refcounting the packets. Conflicts: libavcodec/avpacket.c libavcodec/utils.c libavdevice/v4l2.c libavformat/avidec.c libavformat/flacdec.c libavformat/id3v2.c libavformat/matroskaenc.c libavformat/mux.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 249a023471..dd61962127 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1198,7 +1198,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!=',' && ptr<end-1; ptr++);
if (*ptr == ',')
ptr++;
@@ -1217,13 +1218,14 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
es = ec/ 100; ec -= 100*es;
*ptr++ = '\0';
len = 50 + end-ptr + FF_INPUT_BUFFER_PADDING_SIZE;
- if (!(line = av_malloc(len)))
+ if (!(line = av_buffer_alloc(len)))
return;
- snprintf(line,len,"Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s\r\n",
+ snprintf(line->data, 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);
}
}