[MPlayer-dev-eng] PATCH - Resubmitting get_property chapters patch

Nico Sabbi nicola.sabbi at poste.it
Mon Sep 22 21:31:17 CEST 2008


Il giorno lun, 22/09/2008 alle 07.59 -0600, Kevin DeKorte ha scritto:
> I am resubmitting this patch for obtaining the number of chapters in
> the
> media file since the thread on it kinda died and nobody said 'fix
> this'
> or 'looks good, apply it'.
> 
> This patch is useful to me, so having it in would be nice.
> 
> Thanks,
> 
> Kevin
> --
> Get my public GnuPG key from
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
> 
> 
> La firma esiste, ma è necessaria la
> chiave pubblica
> 
> 
> 
> 
> 
> 
> 
> 
> Differenze tra
> file allegato
> (get_property_chapters_v2.diff)
> 
> Index: DOCS/tech/slave.txt
> ===================================================================
> --- DOCS/tech/slave.txt (revision 27636)
> +++ DOCS/tech/slave.txt (working copy)
> @@ -474,6 +474,7 @@
>  stream_end         pos       0               X            end pos in
> stream
>  stream_length      pos       0               X            (end -
> start)
>  chapter            int       0               X   X   X    select
> chapter
> +chapters           int                       X            number of
> chapters
>  angle              int       0               X   X   X    select
> angle
>  length             time                      X            length of
> file in seconds
>  percent_pos        int       0       100     X   X   X    position in
> percent
> Index: mplayer.c
> ===================================================================
> --- mplayer.c   (revision 27636)
> +++ mplayer.c   (working copy)
> @@ -3530,6 +3530,12 @@
>    }
>    mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_LENGTH=%.2lf\n",
> demuxer_get_time_length(mpctx->demuxer));
>    mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_SEEKABLE=%d\n",
> mpctx->stream->seek ? 1 : 0);
> +  if (mpctx->demuxer) {
> +      if (mpctx->demuxer->num_chapters == 0)
> +         if (mpctx->demuxer->stream)
> +             stream_control(mpctx->demuxer->stream,
> STREAM_CTRL_GET_NUM_CHAPTERS, &mpctx->demuxer->num_chapters);
> +      mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_CHAPTERS=%d\n",
> mpctx->demuxer->num_chapters);
> +  } 


there can't be a demuxer without un underlying stream

>  
>  if(!mpctx->sh_video) goto main; // audio-only
>  
> Index: command.c
> ===================================================================
> --- command.c   (revision 27636)
> +++ command.c   (working copy)
> @@ -447,6 +447,18 @@
>      return M_PROPERTY_OK;
>  }
>  
> +/// Number of chapters in file
> +static int mp_property_chapters(m_option_t *prop, int action, void
> *arg,
> +                               MPContext *mpctx)
> +{
> +    if (!mpctx->demuxer)
> +       return M_PROPERTY_UNAVAILABLE;
> +    if (mpctx->demuxer->num_chapters == 0)
> +       if (mpctx->demuxer->stream)
> +           stream_control(mpctx->demuxer->stream,
> STREAM_CTRL_GET_NUM_CHAPTERS, &mpctx->demuxer->num_chapters);
> +    return m_property_int_ro(prop, action, arg,
> mpctx->demuxer->num_chapters);
> +}
> +

same as above

>  /// Current dvd angle (RW)
>  static int mp_property_angle(m_option_t *prop, int action, void *arg,
>                                 MPContext *mpctx)
> @@ -1983,6 +1995,8 @@
>       M_OPT_MIN, 0, 0, NULL },
>      { "chapter", mp_property_chapter, CONF_TYPE_INT,
>       M_OPT_MIN, 1, 0, NULL },
> +    { "chapters", mp_property_chapters, CONF_TYPE_INT,
> +     0, 0, 0, NULL },
>      { "angle", mp_property_angle, CONF_TYPE_INT,
>       CONF_RANGE, -2, 10, NULL },
>      { "metadata", mp_property_metadata, CONF_TYPE_STRING_LIST,


I don't see anything else wrong with this patch




More information about the MPlayer-dev-eng mailing list