mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -402,13 +402,10 @@ static int decode_new_packet(struct sh_audio *sh)
|
||||
}
|
||||
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
mp_set_av_packet(&pkt, mpkt);
|
||||
pkt.data = start;
|
||||
pkt.size = insize;
|
||||
if (mpkt && mpkt->avpacket) {
|
||||
pkt.side_data = mpkt->avpacket->side_data;
|
||||
pkt.side_data_elems = mpkt->avpacket->side_data_elems;
|
||||
}
|
||||
|
||||
if (pts != MP_NOPTS_VALUE && !packet_already_used) {
|
||||
sh->pts = pts;
|
||||
sh->pts_bytes = 0;
|
||||
|
||||
Reference in New Issue
Block a user