[FFmpeg-devel] [PATCH]refine the flv tagtype read for check as spec

2014-09-04 Thread Steven Liu
from the flv spec, the flvtag define the tagtype as one byte,
the spec desc is:
Reserved  UB[2] Reserved for FMS, should be 0
FilterUB[1] Indicates if packets are filtered.
0 = No pre-processing required.
1 = Pre-processing (such as decryption) of the packet is
required before it can be rendered.
Shall be 0 in unencrypted files, and 1 for encrypted
tags.
See Annex F. FLV Encryption for the use of filters.
TagType   UB[5] Type of contents in this tag. The following types are
defined:
8 = audio
9 = video
18 = script data

Signed-off-by: Steven Liu qi@chinacache.com
---
 libavformat/flvdec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8d9ed8b..a0550b4 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -777,7 +777,7 @@ static int flv_read_packet(
AVFormatContext *s, AVPacket *pkt)
 /* pkt size is repeated at end. skip it */
 for (;; avio_skip(s-pb, 4)) {
 pos  = avio_tell(s-pb);
-type = avio_r8(s-pb);
+type = (avio_r8(s-pb)  0x1F);
 size = avio_rb24(s-pb);
 dts  = avio_rb24(s-pb);
 dts |= avio_r8(s-pb)  24;
@@ -940,7 +940,7 @@ retry_duration:
 if (st-codec-codec_id == AV_CODEC_ID_AAC ||
 st-codec-codec_id == AV_CODEC_ID_H264 ||
 st-codec-codec_id == AV_CODEC_ID_MPEG4) {
-int type = avio_r8(s-pb);
+type = avio_r8(s-pb);
 size--;
 if (st-codec-codec_id == AV_CODEC_ID_H264 || st-codec-codec_id
== AV_CODEC_ID_MPEG4) {
 // sign extension
--
1.7.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]refine the flv tagtype read for check as spec

2014-09-04 Thread Michael Niedermayer
On Thu, Sep 04, 2014 at 08:23:19PM +0800, Steven Liu wrote:
 from the flv spec, the flvtag define the tagtype as one byte,
 the spec desc is:
 Reserved  UB[2] Reserved for FMS, should be 0
 FilterUB[1] Indicates if packets are filtered.
 0 = No pre-processing required.
 1 = Pre-processing (such as decryption) of the packet is
 required before it can be rendered.
 Shall be 0 in unencrypted files, and 1 for encrypted
 tags.
 See Annex F. FLV Encryption for the use of filters.
 TagType   UB[5] Type of contents in this tag. The following types are
 defined:
 8 = audio
 9 = video
 18 = script data
 
 Signed-off-by: Steven Liu qi@chinacache.com
 ---
  libavformat/flvdec.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
 index 8d9ed8b..a0550b4 100644
 --- a/libavformat/flvdec.c
 +++ b/libavformat/flvdec.c
 @@ -777,7 +777,7 @@ static int flv_read_packet(
 AVFormatContext *s, AVPacket *pkt)
  /* pkt size is repeated at end. skip it */
  for (;; avio_skip(s-pb, 4)) {
  pos  = avio_tell(s-pb);
 -type = avio_r8(s-pb);
 +type = (avio_r8(s-pb)  0x1F);
  size = avio_rb24(s-pb);
  dts  = avio_rb24(s-pb);
  dts |= avio_r8(s-pb)  24;

patch applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel