android - Why AVCodecContext extradata is NULL? -


i trying decode h264 video using ffmpeg , stagefright library. i'm using this example.

the example shows how decode mp4 files, want decode h264 video.

here piece of code..

    avformatsource::avformatsource(const char *videopath)      {         av_register_all();          mdatasource = avformat_alloc_context();         avformat_open_input(&mdatasource, videopath, null, null);         (int = 0; < mdatasource->nb_streams; i++)          {             if (mdatasource->streams[i]->codec->codec_type == avmedia_type_video)              {                 mvideoindex = i;                 break;             }         }         mvideotrack = mdatasource->streams[mvideoindex]->codec;          size_t buffersize = (mvideotrack->width * mvideotrack->height * 3) / 2;         mgroup.add_buffer(new mediabuffer(buffersize));         mformat = new metadata;          switch (mvideotrack->codec_id == codec_id_h264)          {             mconverter = av_bitstream_filter_init("h264_mp4toannexb");             mformat->setcstring(kkeymimetype, media_mimetype_video_avc);             if (mvideotrack->extradata[0] == 1) //sigsegv here             {                 mformat->setcstring(kkeymimetype, media_mimetype_video_avc);                 mformat->setdata(kkeyavcc, ktypeavcc, mvideotrack->extradata,                                  mvideotrack->extradata_size);             }          }          mformat->setint32(kkeywidth, mvideotrack->width);         mformat->setint32(kkeyheight, mvideotrack->height);     } 

mvideotrack->extradata null. i'm doing wrong?? question is, should in mvideotrack->extradata kkeyavcc ??

please me, need help. in advance.

if input raw h.264 file, in annex b format. not need "h264_mp4toannexb" conversion. in addition, in annex b, sps/pps sent inline first (or every) idr frame. no data needed. read more here: possible locations sequence/picture parameter set(s) h.264 stream


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -