summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-11 19:10:33 +0200
committerwm4 <wm4@nowhere>2013-07-11 19:10:33 +0200
commita5224836293ac02bd13f688cfc848aae6818e963 (patch)
treec67c9a61505583a0614ccc2c7cdbdb4e1deffda2 /sub
parent07c5327fa0c3411bcb8caad17d70b014d6b022dd (diff)
downloadmpv-a5224836293ac02bd13f688cfc848aae6818e963.tar.bz2
mpv-a5224836293ac02bd13f688cfc848aae6818e963.tar.xz
demux: remove facility for partial packet reads
Partial packet reads were needed because the video/audio parsers were working on top of them. So it could happen that a parser read a part of a packet, and returned that to the decoder. With libavformat/libavcodec, packets are already parsed, and everything is much simpler. Most of the simplifications in ad_spdif could have been done earlier. Remove some other stuff as well, like the questionable slave mode start time reporting (could be replaced by proper code, but we don't bother). Remove the unused skip_audio_frame() functionality as well (it was used by old demuxers). Some functions become private to demux.c, like demux_fill_buffer(). Introduce new packet read functions, which have simpler semantics. Packets returned from them are owned by the caller, and all packets in the demux.c packet queue are considered unread. Remove special code that dropped subtitle packets with size 0. This used to be needed because it caused special cases in the old code.
Diffstat (limited to 'sub')
-rw-r--r--sub/dec_sub.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index fb7e5e4a2a..4351cf60a0 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -380,12 +380,12 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_sub *sh)
preprocess = 1;
for (;;) {
- ds_get_next_pts(sh->ds);
- struct demux_packet *pkt = ds_get_packet_sub(sh->ds);
+ struct demux_packet *pkt = demux_read_packet(sh->gsh);
if (!pkt)
break;
if (preprocess) {
decode_chain(sub->sd, preprocess, pkt);
+ talloc_free(pkt);
while (1) {
pkt = get_decoded_packet(sub->sd[preprocess - 1]);
if (!pkt)
@@ -394,6 +394,7 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_sub *sh)
}
} else {
add_packet(subs, pkt);
+ talloc_free(pkt);
}
}