diff options
author | wm4 <wm4@nowhere> | 2013-06-03 01:55:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-03 22:40:07 +0200 |
commit | 9f4261de65c18d3a34e70c9f969966ca85c80a8d (patch) | |
tree | f9a563589dff67799230508bcc87fe8001fc0ef1 /sub | |
parent | 13a1ce16f9581871cf7ac0d06ece407534a98f89 (diff) | |
download | mpv-9f4261de65c18d3a34e70c9f969966ca85c80a8d.tar.bz2 mpv-9f4261de65c18d3a34e70c9f969966ca85c80a8d.tar.xz |
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.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/sd_lavc_conv.c | 5 |
1 files changed, 1 insertions, 4 deletions
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); } |