[FFmpeg-devel] [RFC][PATCH] Windows Television (WTV) file system handling

Peter Ross pross
Fri Jan 21 00:31:02 CET 2011


On Thu, Jan 20, 2011 at 09:03:57AM -0500, Ronald S. Bultje wrote:
> Hi Peter,
> 
> On Thu, Jan 20, 2011 at 12:19 AM, Peter Ross <pross at xvid.org> wrote:
> > On Sun, Jan 09, 2011 at 05:21:20PM +1100, Peter Ross wrote:
> >> 0002-add-AVFMT_NOGENERICSEEK-flag.patch
> >> * adds AVFMT_NOGENERICSEEK flag, which should be self explanatory.
> [..]
> > @@ -23,7 +23,7 @@
> >
> >  #define LIBAVFORMAT_VERSION_MAJOR 52
> >  #define LIBAVFORMAT_VERSION_MINOR 92
> > -#define LIBAVFORMAT_VERSION_MICRO  0
> > +#define LIBAVFORMAT_VERSION_MICRO  1
> >
> >  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> >                                                 LIBAVFORMAT_VERSION_MINOR, \
> > @@ -324,6 +324,7 @@ typedef struct AVFormatParameters {
> >  #define AVFMT_VARIABLE_FPS  0x0400 /**< Format allows variable fps. */
> >  #define AVFMT_NODIMENSIONS  0x0800 /**< Format does not need width/height */
> >  #define AVFMT_NOSTREAMS     0x1000 /**< Format does not require any streams */
> > +#define AVFMT_NOGENERICSEEK 0x2000 /**< Do not perform generic read_seek */
> >
> >  typedef struct AVOutputFormat {
> >      const char *name;
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index 32067e9..365272b 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -1747,6 +1747,9 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
> >          return 0;
> >      }
> >
> > +    if ((s->iformat->flags & AVFMT_NOGENERICSEEK))
> > +        return -1;
> > +
> >      if(s->iformat->read_timestamp)
> >          return av_seek_frame_binary(s, stream_index, timestamp, flags);
> >      else
> 
> What does this do/fix?

The demuxer sets AVIndexEntry->pos to positions relative to the start of a file
*within* the filesystem. If the demuxer's read_seek() fails, lavf trys to
perform a generic seek using the AVIndexEntry[]->pos values.

> >> 0001-make-unicode-string-reader-accessible-to-other-modu.patch
> >> * the metadata format uses unicode structures similar, but not identical,
> >> ? to ASF/DRV-MS.
> [..]
> >  /**
> > + * Read a null terminated string
> > + */
> > +static void get_utf16z(ByteIOContext *pb, char *buf, int buf_size)
> > +{
> > +    char* q = buf;
> > +    int ch;
> > +    while ((ch = get_le16(pb)))
> > +        if (q - buf < buf_size - 1) *q++ = ch;
> > +    *q = '\0';
> > +}
> 
> Already exists in asfdec.c, probably, and likely mms uses that one
> also. Can you reuse that function? It looks ok in general, I think
> we'd want some files in this format in fate so this sort of stuff is
> tested.
> 
> > +static const ff_asf_guid dir_entry_guid =
> > +    {0x92,0xb7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xdf,0x06,0x3b,0x82,0xcc,0x21,0x3d};
> 
> Should it be in the asf header? Seems duplicated.

Which part is duplicated?

> 
> > +/**
> > + * @param[in] buf unicode buffer
> > + * @param buf_size buffer size (bytes)
> > + * @return 0 if equal
> > + */
> > +static int unicode_compare(const uint8_t *buf, int buf_size, const uint8_t *s)
> 
> I'd be shocked if libc didn't provide some way of doing this, convert
> utf16->utf8 and then strcmp()? Also you don't check buf[i*2+1] ever, I

I do not know of any. While there are wchar functions, one cannot rely on
sizeof(wchar_t)==2.

> know people always make fun of MS using UTF16 and then keeping every
> second byte as a NULL, but it's possible that it is _not_ NULL, right?

Fair point.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110121/0b9adaa7/attachment.pgp>



More information about the ffmpeg-devel mailing list