[vlc-devel] [Patch] Implementing MP4 DEMUX_GET_FPS control query

Hugo Beauzee-Luyssen beauze.h at gmail.com
Thu Sep 17 18:27:56 CEST 2009


On Mon, Sep 14, 2009 at 2:44 PM, Hugo Beauzee-Luyssen
<beauze.h at gmail.com> wrote:
> On Tue, Sep 8, 2009 at 1:17 PM, Hugo Beauzee-Luyssen <beauze.h at gmail.com> wrote:
>> On Sat, Sep 5, 2009 at 11:33 PM, Hugo Beauzee-Luyssen<beauze.h at gmail.com> wrote:
>>> On Sat, Sep 5, 2009 at 11:08 AM, Laurent Aimar<fenrir at via.ecp.fr> wrote:
>>>> Hi,
>>>>
>>>> On Fri, Sep 04, 2009, Hugo Beauzee-Luyssen wrote:
>>>>> The mp4 demuxer's DEMUX_GET_FPS control query wasn't implemented,
>>>>> which was preventing libvlc_media_player_get_fps to access the fps.
>>>>> This patch corrects it.
>>>>
>>>>> From 4926a669a00f7bd6639086835655dc7bd3ca22ae Mon Sep 17 00:00:00 2001
>>>>> From: Hugo Beauzee-Luyssen <beauze.h at gmail.com>
>>>>> Date: Fri, 4 Sep 2009 00:41:36 +0200
>>>>> Subject: [PATCH] Implementing MP4 DEMUX_GET_FPS control query
>>>>>
>>>>> ---
>>>>>  modules/demux/mp4/mp4.c |    8 ++++++--
>>>>>  1 files changed, 6 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
>>>>> index 76aa37c..ebb6023 100644
>>>>> --- a/modules/demux/mp4/mp4.c
>>>>> +++ b/modules/demux/mp4/mp4.c
>>>>> @@ -155,6 +155,7 @@ struct demux_sys_t
>>>>>      uint64_t     i_duration;     /* movie duration */
>>>>>      unsigned int i_tracks;       /* number of tracks */
>>>>>      mp4_track_t  *track;         /* array of track */
>>>>> +    float        f_fps;          /* number of frame per seconds */
>>>>>
>>>>>      /* */
>>>>>      MP4_Box_t    *p_tref_chap;
>>>>> @@ -837,8 +838,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
>>>>>              return VLC_SUCCESS;
>>>>>
>>>>>          case DEMUX_GET_FPS:
>>>>> -            msg_Warn( p_demux, "DEMUX_GET_FPS unimplemented !!" );
>>>>> -            return VLC_EGENERIC;
>>>>> +            pf = (double*)va_arg( args, double* );
>>>>> +            *pf = (double)p_sys->f_fps;
>>>>> +            return VLC_SUCCESS;
>>>>>
>>>>>          case DEMUX_GET_META:
>>>>>          {
>>>>> @@ -1518,6 +1520,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
>>>>>              p_track->fmt.video.i_frame_rate_base =
>>>>>                  p_box->data.p_stts->i_sample_delta[0];
>>>>>          }
>>>>> +        p_demux->p_sys->f_fps = (float)p_track->i_timescale /
>>>>> +                                (float)p_track->fmt.video.i_frame_rate_base;
>>>>  It would be more coherent to use p_track->fmt.video.i_frame_rate instead
>>>> of p_track->i_timescale.
>>>>
>>>>  Now, I highly doubt it work well on a lot of files, i_timescale is not bound to
>>>> represent the frame rate at all.
>>>>  I think the most reliable way would be to count the number of frames and the total
>>>> duration to estimate the frame rate. I think that the last message in
>>>> TrackCreateSamplesIndex use the needed informations (but I am not sure).
>>>>
>>>> Regards,
>>>>
>>>
>
> Since this is how FPS are computed in this demux, I can't see any
> other way of doing this.
> Any hints ??
>
> Regards,
>
>

Hi,

I apologize for replying this thread 4 times in a row, but this is a
feature we really need in VLMC.
Could you give us any instructions on how to make it ready to apply ?

Best regards,


-- 
Hugo Beauzée-Luyssen



More information about the vlc-devel mailing list