[FFmpeg-devel] [PATCH 3/3] ffplay integration for seek api

Michael Niedermayer michaelni
Thu Aug 19 12:42:53 CEST 2010


On Thu, Aug 19, 2010 at 11:30:58AM +0200, Michael Chinen wrote:
> Hi,
> 
> On Tue, Aug 17, 2010 at 2:18 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Fri, Aug 13, 2010 at 08:15:23AM +0200, Michael Chinen wrote:
> >> $subj
> >
> >> ?ffplay.c | ? 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> ?1 file changed, 74 insertions(+)
> >> e58f5a2de15bd451e349756727bd66da88f7621f ?0003-ffplay-integration-for-seek-api.patch
> >> From d967a186a6841ee818a1e7cbda4b88ece0e57e10 Mon Sep 17 00:00:00 2001
> >> From: Michael Chinen <mchinen at gmail.com>
> >> Date: Fri, 13 Aug 2010 05:49:02 +0200
> >> Subject: [PATCH 3/3] ffplay integration for seek api
> >>
> >> ---
> >> ?ffplay.c | ? 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> ?1 files changed, 74 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/ffplay.c b/ffplay.c
> >> index fa3def1..b7dcc52 100644
> >> --- a/ffplay.c
> >> +++ b/ffplay.c
> >> @@ -224,6 +224,9 @@ static int audio_write_get_buf_size(VideoState *is);
> >> ?/* options specified by the user */
> >> ?static AVInputFormat *file_iformat;
> >> ?static const char *input_filename;
> >> +static const char *index_load_filename;
> >> +static const char *index_save_filename;
> >> +static char *index_filename = NULL;
> >> ?static const char *window_title;
> >> ?static int fs_screen_width;
> >> ?static int fs_screen_height;
> >
> >> @@ -265,6 +268,11 @@ static int exit_on_keydown;
> >> ?static int exit_on_mousedown;
> >> ?static int loop=1;
> >> ?static int framedrop=1;
> >> +static int build_table ? ?= 0;
> >> +static int parallel_table = 0;
> >> +static int load_table ? ? = 0;
> >> +static int save_table ? ? = 0;
> >> +static int cbr_table ? ? ?= 0;
> >
> > the = 0 are redundant
> 
> Fixed (including the = NULL)
> 
> >
> >
> >>
> >> ?static int rdftspeed=20;
> >> ?#if CONFIG_AVFILTER
> >> @@ -2369,6 +2377,28 @@ static int decode_interrupt_cb(void)
> >> ? ? ?return (global_video_state && global_video_state->abort_request);
> >> ?}
> >>
> >> +static int build_index_thread(void *arg)
> >
> > doxy: build index and safe to file or something
> 
> Done
> 
> Michael

>  ffplay.c |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
> 859de25f56c1733271552f4554f17f945a193368  0003-ffplay-integration-for-seek-api.patch
> From 63e45779b4bb322bc56abaa4b03613e552db89e9 Mon Sep 17 00:00:00 2001
> From: Michael Chinen <mchinen at gmail.com>
> Date: Thu, 19 Aug 2010 11:08:25 +0200
> Subject: [PATCH 3/3] ffplay integration for seek api
> 
> 2nd submission - MN's review
> remove redundant option variable inits
> doxy comments
> remove irrelevant put packet flush
> ---
>  ffplay.c |   77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 77 insertions(+), 0 deletions(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index fa3def1..873276a 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -224,6 +224,9 @@ static int audio_write_get_buf_size(VideoState *is);
>  /* options specified by the user */
>  static AVInputFormat *file_iformat;
>  static const char *input_filename;
> +static const char *index_load_filename;
> +static const char *index_save_filename;
> +static char *index_filename;
>  static const char *window_title;
>  static int fs_screen_width;
>  static int fs_screen_height;
> @@ -265,6 +268,11 @@ static int exit_on_keydown;
>  static int exit_on_mousedown;
>  static int loop=1;
>  static int framedrop=1;
> +static int build_table;
> +static int parallel_table;
> +static int load_table;
> +static int save_table;
> +static int cbr_table;
>  
>  static int rdftspeed=20;
>  #if CONFIG_AVFILTER
> @@ -2369,6 +2377,31 @@ static int decode_interrupt_cb(void)
>      return (global_video_state && global_video_state->abort_request);
>  }
>  
> +/**
> + * Build index and save to file (if the -savetable option was given)
> + */
> +static int build_index_thread(void *arg)
> +{
> +    int i;
> +    int done            = 0;
> +    AVFormatContext *ic = arg;
> +    i = AV_BUILD_INDEX_PARALLEL | (cbr_table ? AV_BUILD_INDEX_USE_CBR : 0);
> +    av_build_index(ic, i);

> +    while(save_table && !done) {
> +        SDL_Delay(100);
> +        done = 1;
> +        for(i = 0; i < ic->nb_streams; i++) {
> +            if(!(ic->streams[i]->seek_table_flags & AV_SEEKTABLE_FINISHED))
> +                done = 0;
> +        }
> +    }

this needs a comment explaining on what we are waiting here
also it needs to be documented in the api as applications have to
do it as well.
that said it would be nice if it could be avoided its not pretty.
maybe passing a function pointer into 
av_save_index_file() to a SDL_Delay() like thing could simplify the
public api? maybe there are other solutions i dont know


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100819/3c4cdeab/attachment.pgp>



More information about the ffmpeg-devel mailing list