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 /video | |
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 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index fff44edaed..540204bcfd 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -673,17 +673,8 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, else avctx->skip_frame = ctx->skip_frame; - av_init_packet(&pkt); - pkt.data = packet ? packet->buffer : NULL; - pkt.size = packet ? packet->len : 0; - /* Some codecs (ZeroCodec, some cases of PNG) may want keyframe info - * from demuxer. */ - if (packet && packet->keyframe) - pkt.flags |= AV_PKT_FLAG_KEY; - if (packet && packet->avpacket) { - pkt.side_data = packet->avpacket->side_data; - pkt.side_data_elems = packet->avpacket->side_data_elems; - } + mp_set_av_packet(&pkt, packet); + // The avcodec opaque field stupidly supports only int64_t type union pts { int64_t i; double d; }; avctx->reordered_opaque = (union pts){.d = *reordered_pts}.i; |