[FFmpeg-devel] [PATCH] Add VPlayer demuxer and decoder.

Clément Bœsch ubitux at gmail.com
Sun Dec 30 22:52:53 CET 2012


On Sat, Dec 29, 2012 at 01:16:17PM +0100, Stefano Sabatini wrote:
> On date Thursday 2012-12-27 22:55:19 +0100, Clément Bœsch encoded:
> > Note that the linebreaks text codec option (but not the feature) has
> > been removed; its main goal was to allow demuxers to configure the text
> > decoder (and not meant to be used by users), but the AVOption are not a
> > viable solution. This is solved differently in this commit.
> > ---
> > To be applied on top of the MPL2 patch.
> > ---
> >  Changelog                  |   2 +-
> >  libavcodec/Makefile        |   1 +
> >  libavcodec/allcodecs.c     |   1 +
> >  libavcodec/avcodec.h       |   1 +
> >  libavcodec/textdec.c       |  45 ++++++++++++---
> >  libavcodec/version.h       |   2 +-
> >  libavformat/Makefile       |   1 +
> >  libavformat/allformats.c   |   1 +
> >  libavformat/version.h      |   2 +-
> >  libavformat/vplayerdec.c   | 135 +++++++++++++++++++++++++++++++++++++++++++++
> >  tests/fate/subtitles.mak   |   3 +
> >  tests/ref/fate/sub-vplayer |   1 +
> 
> Missing doc/general.texi entry?
> 

Yup, added.

[...]
> > +#define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = {   \
> > +    .class_name = #decname " decoder",      \
> > +    .item_name  = av_default_item_name,     \
> > +    .option     = decname ## _options,      \
> > +    .version    = LIBAVUTIL_VERSION_INT,    \
> > +}
> 
> Note: such a define would be useful as an internal utility (check
> AVFILTER_DEFINE_CLASS).
> 

Yes, could be nice.

[...]
> > +/**
> > + * @file
> > + * VPlayer subtitles format demuxer
> 
> Note: a link to the spec/doc is welcome.
> 

I didn't find anything :(

> > + */
> > +
> > +#include "avformat.h"
> > +#include "internal.h"
> > +#include "subtitles.h"
> > +#include "libavutil/opt.h"
> > +#include "libavutil/avstring.h"
> > +#include "libavutil/bprint.h"
> > +#include "libavutil/intreadwrite.h"
> > +
> > +typedef struct {
> > +    FFDemuxSubtitlesQueue q;
> > +} VPlayerContext;
> > +
> > +static int vplayer_probe(AVProbeData *p)
> > +{
> > +    char c;
> > +    int hh, mm, ss, ms;
> > +    const unsigned char *ptr = p->buf;
> > +
> > +    if (sscanf(ptr, "%d:%d:%d.%d%c",
> > +               &hh, &mm, &ss, &ms, &c) == 5 && strchr(": =", c))
> > +        return AVPROBE_SCORE_MAX;
> > +    return 0;
> > +}
> > +
> > +static int64_t read_ts(char **line)
> > +{
> > +    char c;
> > +    int hh, mm, ss, ms, len;
> > +
> > +    if (sscanf(*line, "%d:%d:%d.%d%c%n",
> > +               &hh, &mm, &ss, &ms, &c, &len) >= 5) {
> > +        *line += len;
> > +        return (hh*3600LL + mm*60LL + ss) * 100LL + ms;
> > +    }
> > +    return AV_NOPTS_VALUE;
> > +}
> > +
> > +static int vplayer_read_header(AVFormatContext *s)
> > +{
> > +    VPlayerContext *vplayer = s->priv_data;
> > +    AVStream *st = avformat_new_stream(s, NULL);
> 
> > +    int res = 0;
> 
> unused
> 

Removed.

[...]
> 
> LGTM otherwise.

Thanks, applied.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121230/a7b1bc08/attachment.asc>


More information about the ffmpeg-devel mailing list