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>
This commit is contained in:
Michael Niedermayer
2013-03-08 17:28:42 +01:00
24 changed files with 362 additions and 207 deletions

View File

@@ -1282,9 +1282,10 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
asf_st->ds_span);
} else {
/* packet descrambling */
uint8_t *newdata = av_malloc(asf_st->pkt.size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (newdata) {
AVBufferRef *buf = av_buffer_alloc(asf_st->pkt.size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (buf) {
uint8_t *newdata = buf->data;
int offset = 0;
memset(newdata + asf_st->pkt.size, 0,
FF_INPUT_BUFFER_PADDING_SIZE);
@@ -1300,13 +1301,18 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
asf_st->ds_chunk_size);
offset += asf_st->ds_chunk_size;
}
av_free(asf_st->pkt.data);
asf_st->pkt.data = newdata;
av_buffer_unref(&asf_st->pkt.buf);
asf_st->pkt.buf = buf;
asf_st->pkt.data = buf->data;
}
}
}
asf_st->frag_offset = 0;
*pkt = asf_st->pkt;
#if FF_API_DESTRUCT_PACKET
asf_st->pkt.destruct = NULL;
#endif
asf_st->pkt.buf = 0;
asf_st->pkt.size = 0;
asf_st->pkt.data = 0;
asf_st->pkt.side_data_elems = 0;