[FFmpeg-cvslog] Make detection of single-stream flv work again.

Reimar Döffinger git at videolan.org
Sat Dec 10 19:35:35 CET 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Wed Dec  7 21:51:27 2011 +0100| [8b8a47f6fba938266e142367ab7f714af430503a] | committer: Reimar Döffinger

Make detection of single-stream flv work again.

It had become dead code when code was added to avoid
exporting audio and video codec id as metadata.
Untested due to lack of sample.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b8a47f6fba938266e142367ab7f714af430503a
---

 libavformat/flvdec.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 50eb3ba..0699f54 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -292,6 +292,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
                 acodec->bit_rate = num_val * 1024.0;
         }
 
+        if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
+           ((!acodec && !strcmp(key, "audiocodecid")) ||
+            (!vcodec && !strcmp(key, "videocodecid"))))
+                s->ctx_flags &= ~AVFMTCTX_NOHEADER; //If there is either audio/video missing, codecid will be an empty object
+
         if (!strcmp(key, "duration")        ||
             !strcmp(key, "filesize")        ||
             !strcmp(key, "width")           ||
@@ -312,10 +317,6 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
         } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
             snprintf(str_val, sizeof(str_val), "%.f", num_val);
             av_dict_set(&s->metadata, key, str_val, 0);
-        } else if(amf_type == AMF_DATA_TYPE_OBJECT){
-            if(s->nb_streams==1 && ((!acodec && !strcmp(key, "audiocodecid")) || (!vcodec && !strcmp(key, "videocodecid")))){
-                s->ctx_flags &= ~AVFMTCTX_NOHEADER; //If there is either audio/video missing, codecid will be an empty object
-            }
         } else if (amf_type == AMF_DATA_TYPE_STRING)
             av_dict_set(&s->metadata, key, str_val, 0);
     }



More information about the ffmpeg-cvslog mailing list