[MPlayer-dev-eng] Re: [RFC] h264 over rtsp without AVParser

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 9 14:04:40 CET 2007


Michael Niedermayer <michaelni <at> gmx.at> writes:

> > Convince libavcodec to always assume CODEC_FLAG2_CHUNKS, Michael already
> > suggested that before (and will hopefully help)
> 
> making CODEC_FLAG2_CHUNKS default?
> 
> if you are serious about this you will have to implement the mess in
> 7.4.1.2.3 Order of NAL units and coded pictures and association to access units
> 7.4.1.2.4 Detection of the first VCL NAL unit of a primary coded picture
> of the h.264 spec (freely available from ITU IIRC)

I just meant to remove the if (flags2 & CODEC_FLAG2_CHUNKS) checks and make NALs
which might not be complete frames default.

However, how is mplayer supposed to set CODEC_FLAG2_CHUNKS? Is an approach like
the following (inlined) acceptable?

===================================================================
--- libmpcodecs/vd_ffmpeg.c     (Revision 22495)
+++ libmpcodecs/vd_ffmpeg.c     (Arbeitskopie)
@@ -34,6 +34,7 @@
 #endif

 int avcodec_inited=0;
+int h264_has_chunks=0;

 typedef struct {
     AVCodecContext *avctx;
@@ -296,6 +297,10 @@
 #ifdef CODEC_FLAG2_FAST
     avctx->flags2|= lavc_param_fast;
 #endif
+#ifdef CODEC_FLAG2_CHUNKS
+    if (h264_has_chunks)
+        avctx->flags2|= CODEC_FLAG2_CHUNKS;
+#endif
     avctx->codec_tag= sh->format;
     avctx->stream_codec_tag= sh->video.fccHandler;
     avctx->idct_algo= lavc_param_idct_algo;

If not, how is lavcodec supposed to know that it should accept NALs that are not
complete frames?

Thank you, Carl Eugen




More information about the MPlayer-dev-eng mailing list