[FFmpeg-devel] [PATCH] Speex parser

Michael Niedermayer michaelni
Mon Sep 21 10:12:56 CEST 2009


On Mon, Sep 21, 2009 at 03:52:02AM +0200, Michael Niedermayer wrote:
> On Mon, Sep 21, 2009 at 12:23:45AM +0100, M?ns Rullg?rd wrote:
> > Michael Niedermayer <michaelni at gmx.at> writes:
> > 
> > > On Sun, Sep 20, 2009 at 10:05:36PM +0100, M?ns Rullg?rd wrote:
> > >> "Ronald S. Bultje" <rsbultje at gmail.com> writes:
> > >> 
> > >> > Hi,
> > >> >
> > >> > 2009/9/20 M?ns Rullg?rd <mans at mansr.com>:
> > >> >> What I would like is a raw demuxer returning exactly what is in the
> > >> >> file, no decoding, no parsing. ?This can be done separately if
> > >> >> needed.
> > >> >
> > >> > Isn't that av_read_packet() (instead of av_read_frame())?
> > >> 
> > >> Sort of, except that av_read_packet() doesn't actually work.  During
> > >> file opening, some packets are read, analysed, and placed in a queue.
> > >> This queue is bypassed by av_read_packet() so you miss the first few
> > >> packets of the file.
> > >> 
> > >> It is possible to open a file without having it analysed, but then yet
> > >> other things stop working, e.g. the list of streams might not be
> > >> populated for an mpeg-ps file.
> > >
> > > iam trying to implement what you want but iam hitting a wall here
> > > there really are so many things filled in and you clearly do want many
> > > to be kept. I cant read your mind, please say clearly which values you
> > > want not to be filled in by lavf?
> > 
> > I don't need this urgently or anything, so don't spend your time on
> > this unless you really want to.  
> 
> it should be easy to implement, if i run into some problems ill
> put it aside and maybe post a patch for others to finish ...

first try below (not really tested as i dont have an application that can
handle the more raw output)

also comments welcome, especially what to change on itm, if theres anything
else that still set that should be disabled or something thats not set but
turns out to be needed after all


Index: libavformat/avformat.h
===================================================================
--- libavformat/avformat.h	(revision 19933)
+++ libavformat/avformat.h	(working copy)
@@ -572,6 +572,8 @@
 #define AVFMT_FLAG_GENPTS       0x0001 ///< Generate missing pts even if it requires parsing future frames.
 #define AVFMT_FLAG_IGNIDX       0x0002 ///< Ignore index.
 #define AVFMT_FLAG_NONBLOCK     0x0004 ///< Do not block when reading packets from input.
+#define AVFMT_FLAG_NOFILLIN     0x0008 ///< Do not infer any values from other values, just return what is stored in the container
+#define AVFMT_FLAG_NOPARSE      0x0010 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
 
     int loop_input;
     /** decoding: size of data to probe; encoding: unused. */
Index: libavformat/options.c
===================================================================
--- libavformat/options.c	(revision 19933)
+++ libavformat/options.c	(working copy)
@@ -46,6 +46,8 @@
 {"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, D|E, "fflags"},
 {"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNIDX, INT_MIN, INT_MAX, D, "fflags"},
 {"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
+{"nofillin", "do not fill in missing values that can be exactly calculated", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOFILLIN, INT_MIN, INT_MAX, D, "fflags"},
+{"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"},
 #if LIBAVFORMAT_VERSION_INT < (53<<16)
 {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
 {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c	(revision 19933)
+++ libavformat/utils.c	(working copy)
@@ -770,6 +770,9 @@
     int num, den, presentation_delayed, delay, i;
     int64_t offset;
 
+    if(s->flags & AVFMT_FLAG_NOFILLIN)
+        return;
+
     if (pc && pc->pict_type == FF_B_TYPE)
         st->codec->has_b_frames = 1;
 
@@ -1022,7 +1025,7 @@
             s->cur_st = st;
             st->cur_ptr = st->cur_pkt.data;
             st->cur_len = st->cur_pkt.size;
-            if (st->need_parsing && !st->parser) {
+            if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
                 st->parser = av_parser_init(st->codec->codec_id);
                 if (!st->parser) {
                     /* no parser available: just output the raw packets */
@@ -2045,7 +2048,7 @@
                 st->codec->time_base= st->time_base;
         }
         //only for the split stuff
-        if (!st->parser) {
+        if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
             st->parser = av_parser_init(st->codec->codec_id);
             if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
                 st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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-devel/attachments/20090921/236b1589/attachment.pgp>



More information about the ffmpeg-devel mailing list