[Libav-user] how to know whether AVFrame is audio frame or video frame

salsaman salsaman at gmail.com
Thu Apr 21 15:20:40 CEST 2016


If you have something like:

 ret = avcodec_decode_video2(cc, frame, &gotFrame, &packet);


then:

 switch (cc->codec_type) {
    case AVMEDIA_TYPE_VIDEO:
        // is video
       break;
    case AVMEDIA_TYPE_AUDIO:
       // is audio
       break;

   default:
      // other (e.g subtitle)
      break;
  }



Cheers,
Salsaman.





http://lives-video.com
https://www.openhub.net/accounts/salsaman

On Wed, Apr 20, 2016 at 7:34 AM, qw <applemax82 at 163.com> wrote:

> Hi,
>
> how to know whether AVFrame is audio frame or video frame?
>
> Thanks!
>
> B.R.
>
> Andrew
>
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160421/07e5b9fb/attachment.html>


More information about the Libav-user mailing list