[MPlayer-dev-eng] [PATCH] Maintain subtitles in pts order in spudec.c

Guillaume POIRIER poirierg at gmail.com
Tue Jan 23 10:45:14 CET 2007


Hi,

An old mail I saw while cleaning up my mailbox...

On 24 Sep 2005 19:28:40 -0000, Wolfram Gloger
<wmglo at 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



More information about the MPlayer-dev-eng mailing list