[FFmpeg-devel] [PATCH 2/2] avformat/flvdec: re enable flv_data_packet() and use AVMEDIA_TYPE_SUBTITLE

Michael Niedermayer michaelni at gmx.at
Fri Mar 13 16:05:16 CET 2015


On Fri, Mar 13, 2015 at 01:49:39PM +0100, Andreas Cadhalpun wrote:
> On 21.01.2015 00:10, Michael Niedermayer wrote:
> > Found-by: kurosu
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/flvdec.c |   15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > index 572268f..f98cb97 100644
> > --- a/libavformat/flvdec.c
> > +++ b/libavformat/flvdec.c
> > @@ -482,7 +482,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
> >                           0 <= (int)(num_val * 1024.0))
> >                      acodec->bit_rate = num_val * 1024.0;
> >                  else if (!strcmp(key, "datastream")) {
> > -                    AVStream *st = create_stream(s, AVMEDIA_TYPE_DATA);
> > +                    AVStream *st = create_stream(s, AVMEDIA_TYPE_SUBTITLE);
> >                      if (!st)
> >                          return AVERROR(ENOMEM);
> >                      st->codec->codec_id = AV_CODEC_ID_TEXT;
> > @@ -749,12 +749,12 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
> >  
> >      for (i = 0; i < s->nb_streams; i++) {
> >          st = s->streams[i];
> > -        if (st->codec->codec_type == AVMEDIA_TYPE_DATA)
> > +        if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
> >              break;
> >      }
> >  
> >      if (i == s->nb_streams) {
> > -        st = create_stream(s, AVMEDIA_TYPE_DATA);
> > +        st = create_stream(s, AVMEDIA_TYPE_SUBTITLE);
> >          if (!st)
> >              return AVERROR(ENOMEM);
> >          st->codec->codec_id = AV_CODEC_ID_TEXT;
> 
> The changes above seem to be unrelated to those below, so please split.
> Also there are more occurrences of AVMEDIA_TYPE_DATA in flvdec.c.
> Why are those not changed as well?

a lack of testcases, but i just found some files that trigger subsets
of the code. Ill add avpriv_request_sample() where i lack testcases
and update the other AVMEDIA_TYPE_DATA


> 
> > @@ -830,11 +830,14 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
> >                  goto skip;
> >          } else if (type == FLV_TAG_TYPE_META) {
> >              stream_type=FLV_STREAM_TYPE_DATA;
> > -            if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
> > +            if (size > 13 + 1 + 4) { // Header-type metadata stuff
> > +                int type;
> >                  meta_pos = avio_tell(s->pb);
> > -                if (flv_read_metabody(s, next) <= 0) {
> > +                type = flv_read_metabody(s, next);
> > +                if (type == 0 && dts == 0 || type < 0) {
> >                      goto skip;
> > -                }
> > +                } else if (type == TYPE_ONTEXTDATA)
> > +                    return flv_data_packet(s, pkt, dts, next);
> >                  avio_seek(s->pb, meta_pos, SEEK_SET);
> >              }
> >          } else {
> > 
> 
> The only difference to my attempt to fix this is the handling of dts == 0.
> I think it's more correct in this patch, so this part looks good to me.

ok, will split,
test as far as i can with the samples i have
and apply

thanks

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

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150313/69e3f884/attachment.asc>


More information about the ffmpeg-devel mailing list