[FFmpeg-soc] [soc]: r5831 - seek2010/seek2010.patch

Michael Niedermayer michaelni at gmx.at
Wed Jun 16 21:47:42 CEST 2010


On Tue, Jun 15, 2010 at 06:52:35PM +0200, mchinen wrote:
> Author: mchinen
> Date: Tue Jun 15 18:52:35 2010
> New Revision: 5831
> 
> Log:
> adding thread-safe (optional flag) support for av_build_index

why isnt it thread safe to begin with?


> 
> Modified:
>    seek2010/seek2010.patch
> 
> Modified: seek2010/seek2010.patch
> ==============================================================================
> --- seek2010/seek2010.patch	Sat Jun 12 19:10:27 2010	(r5830)
> +++ seek2010/seek2010.patch	Tue Jun 15 18:52:35 2010	(r5831)
> @@ -1,19 +1,19 @@
>  Index: ffplay.c
>  ===================================================================
> ---- ffplay.c	(revision 23548)
> +--- ffplay.c	(revision 23615)
>  +++ ffplay.c	(working copy)
>  @@ -2501,6 +2501,8 @@
>           goto fail;
>       }
>   
> -+    av_build_index(ic, 0);    
> ++    av_build_index(ic, AV_BUILD_INDEX_THREADSAFE);    
>  +

trailing whitespace is forbidden in ffmpeg svn
and so are tabs
[...]

> @@ -178,12 +178,13 @@ Index: libavformat/avformat.h
>  + * Part of the new seeking api.  incomplete.
>  + */
>  +int av_build_index(AVFormatContext *s, int flags);
> ++#define AV_BUILD_INDEX_THREADSAFE 0x0001
>  +
>  +/**
>    * Ensures the index uses less memory than the maximum specified in
>    * AVFormatContext.max_index_size by discarding entries if it grows
>    * too large.

this is missing documentation


[...]
> @@ -574,36 +575,84 @@ Index: libavformat/utils.c
>  +	    s->streams[i]->seek_table.flags |= AV_SEEKTABLE_COPIED;
>  +	}
>  +    } else {
> ++	AVFormatContext *build_ic;
>  +        AVPacket pkt;
>  +
> -+        /* default table generation behavior from av_seek_frame_generic */
> -+	/* TODO: see why s->data_offset is the file length for avi/mp4 and others */
> -+	
> -+	/* use an independent file pointer so that we can use this call in multithreaded contexts*/
> -+	/* not complete yet - see av_read_packet to see how we need to swap out the old file pointers*/
> -+	ByteIOContext* pb;
> -+
>  +	printf("SEEK_TABLE_DEBUG: building index from scratch\n");
>  +
> -+        if ((ret=url_fopen(&pb, s->filename, URL_RDONLY)) < 0) {
> -+	    return ret;
> ++	/* if the client needs it to be threadsafe, create a new format context to read from. */
> ++	if(flags & AV_BUILD_INDEX_THREADSAFE) {

> ++	    printf("SEEK_TABLE_DEBUG: making thread-safe copy of streams\n");

you cant do printf() in libav*
also patches of patches are totally unreadable


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

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20100616/2c50f6e5/attachment.pgp>


More information about the FFmpeg-soc mailing list