[PATCH] Maintain subtitles in pts order in spudec.c
Hi! I think subtitles in spudec.c should be maintained in start_pts order. E.g. when detecting timestamps and substreams in demux_mpg_open(), a subtitle from near the end of the input file can be read, which subsequently "blocks" the list -- the first packet is never taken in spudec_heartbeat(). Alternatively, demux_mpg_open() could at its end flush the queue with spudec_reset(), but I think the following is also very simple and preferable, because it is also tolerant against subtitles in the wrong order in a broken input file. Regards, Wolfram. diff -urb MPlayer-1.0pre7/spudec.c MPlayer-1.0pre7-wg/spudec.c --- MPlayer-1.0pre7/spudec.c Sat Jan 8 22:06:04 2005 +++ MPlayer-1.0pre7-wg/spudec.c Fri Sep 23 14:19:29 2005 @@ -95,11 +95,22 @@ static void spudec_queue_packet(spudec_handle_t *this, packet_t *packet) { - if (this->queue_head == NULL) + packet_t *last = 0, *p = this->queue_head; + while (p && p->start_pts<packet->start_pts) { + last = p; + p = p->next; + } + if (last) { + packet->next = last->next; + last->next = packet; + if (last == this->queue_tail) + this->queue_tail = packet; + } else { + packet->next = p; this->queue_head = packet; - else - this->queue_tail->next = packet; + if (!p) this->queue_tail = packet; + } } static packet_t *spudec_dequeue_packet(spudec_handle_t *this)
Hi, An old mail I saw while cleaning up my mailbox... On 24 Sep 2005 19:28:40 -0000, Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> wrote:
Hi!
I think subtitles in spudec.c should be maintained in start_pts order.
E.g. when detecting timestamps and substreams in demux_mpg_open(), a subtitle from near the end of the input file can be read, which subsequently "blocks" the list -- the first packet is never taken in spudec_heartbeat().
Alternatively, demux_mpg_open() could at its end flush the queue with spudec_reset(), but I think the following is also very simple and preferable, because it is also tolerant against subtitles in the wrong order in a broken input file.
Regards, Wolfram.
diff -urb MPlayer-1.0pre7/spudec.c MPlayer-1.0pre7-wg/spudec.c --- MPlayer-1.0pre7/spudec.c Sat Jan 8 22:06:04 2005 +++ MPlayer-1.0pre7-wg/spudec.c Fri Sep 23 14:19:29 2005 @@ -95,11 +95,22 @@
static void spudec_queue_packet(spudec_handle_t *this, packet_t *packet) { - if (this->queue_head == NULL) + packet_t *last = 0, *p = this->queue_head; + while (p && p->start_pts<packet->start_pts) { + last = p; + p = p->next; + } + if (last) { + packet->next = last->next; + last->next = packet; + if (last == this->queue_tail) + this->queue_tail = packet; + } else { + packet->next = p; this->queue_head = packet; - else - this->queue_tail->next = packet; + if (!p) this->queue_tail = packet; + } }
static packet_t *spudec_dequeue_packet(spudec_handle_t *this)
patches are to be generated against CVS and included as attachment... yet ... What to do with this patch? uau, you usually follow issues that involve PTS... could you comment on this patch? Guillaume -- Reading doesn't hurt, really! -- Dominik 'Rathann' Mierzejewski
Hi,
An old mail I saw while cleaning up my mailbox...
Wow. Thanks a lot for not forgetting this..
patches are to be generated against CVS and included as attachment...
ITYM "svn" not CVS :-) "updated" patch attached. The patch still applies unchanged. I have recently unsubscribed from mplayer-dev-eng, though, so the mail may not come through there. Regards, Wolfram.
Orgiginal message, sent month ago: I think subtitles in spudec.c should be maintained in start_pts order. E.g. when detecting timestamps and substreams in demux_mpg_open(), a subtitle from near the end of the input file can be read, which subsequently "blocks" the list -- the first packet is never taken in spudec_heartbeat(). Alternatively, demux_mpg_open() could at its end flush the queue with spudec_reset(), but I think the following is also very simple and preferable, because it is also tolerant against subtitles in the wrong order in a broken input file. Regards, Wolfram. Here's Wolfram's response: ---------- Forwarded message ---------- From: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> Date: 23 Jan 2007 10:18:00 -0000 Subject: Re: [MPlayer-dev-eng] [PATCH] Maintain subtitles in pts order in spudec.c To: poirierg@gmail.com Cc: mplayer-dev-eng@mplayerhq.hu, wmglo@dent.med.uni-muenchen.de Hi,
An old mail I saw while cleaning up my mailbox...
Wow. Thanks a lot for not forgetting this..
patches are to be generated against CVS and included as attachment...
ITYM "svn" not CVS :-) "updated" patch attached. The patch still applies unchanged. I have recently unsubscribed from mplayer-dev-eng, though, so the mail may not come through there. Regards, Wolfram.
participants (2)
-
Guillaume POIRIER -
Wolfram Gloger