Read h264 headers from v4l2 to allow stream-copying.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Sun, 1 Sep 2013 18:20:47 +0000 (20:20 +0200)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 5 Sep 2013 20:49:52 +0000 (22:49 +0200)
Fixes ticket #2882.
Analyzed and tested by William C Bonner.
(cherry picked from commit e337c9d56408dc00a15887309488a1ff5cb06ba3)

libavdevice/v4l2.c

index 1f43f07..b1dc7d1 100644 (file)
@@ -929,6 +929,9 @@ static int v4l2_read_header(AVFormatContext *s1)
     if (codec_id == AV_CODEC_ID_RAWVIDEO)
         st->codec->codec_tag =
             avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
+    else if (codec_id == AV_CODEC_ID_H264) {
+        st->need_parsing = AVSTREAM_PARSE_HEADERS;
+    }
     if (desired_format == V4L2_PIX_FMT_YVU420)
         st->codec->codec_tag = MKTAG('Y', 'V', '1', '2');
     else if (desired_format == V4L2_PIX_FMT_YVU410)