From 9f4261de65c18d3a34e70c9f969966ca85c80a8d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 3 Jun 2013 01:55:48 +0200 Subject: core: add common function to initialize AVPacket Audio and video had their own (very similar) functions to initialize an AVPacket (ffmpeg's packet struct) from a demux_packet (mplayer's packet struct). Add a common function for these. Also use this function for sd_lavc_conv. This is actually a functional change, as some libavfilter subtitle demuxers add weird out-of-band stuff as side-data. --- sub/sd_lavc_conv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sub') diff --git a/sub/sd_lavc_conv.c b/sub/sd_lavc_conv.c index 9c7a6f2c5f..5653ad87f9 100644 --- a/sub/sd_lavc_conv.c +++ b/sub/sd_lavc_conv.c @@ -114,9 +114,7 @@ static void decode(struct sd *sd, struct demux_packet *packet) AVPacket pkt; int ret, got_sub; - av_init_packet(&pkt); - pkt.data = packet->buffer; - pkt.size = packet->len; + mp_set_av_packet(&pkt, packet); pkt.pts = packet->pts == MP_NOPTS_VALUE ? AV_NOPTS_VALUE : packet->pts * ts; pkt.duration = packet->duration * ts; @@ -136,7 +134,6 @@ static void decode(struct sd *sd, struct demux_packet *packet) } } - av_free_packet(&pkt); avsubtitle_free(&sub); } -- cgit v1.2.3