[FFmpeg-devel] [PATCH]Silence warnings when decoding Q264

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Dec 2 20:55:21 CET 2011


Hi!

QNAP offers surveillance cameras that provide a H264 stream whose frames all 
start with "Q264". Some frames are empty, the non-empty ones have a "5" at the 
tenth position of the frame in the two samples we have.
Attached patch fixes the warnings from ticket 571.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 0b8798d..c859026 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -310,6 +310,11 @@ static int h264_parse(AVCodecParserContext *s,
             ff_h264_find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state
         }
     }
+    if (buf_size >= 10 && !memcmp(buf, "Q264\1\0\0\0\0\0", 10)){
+        *poutbuf = NULL;
+        *poutbuf_size = 0;
+        return buf_size;
+    }
 
     if(!h->is_avc){
     parse_nal_units(s, avctx, buf, buf_size);


More information about the ffmpeg-devel mailing list