Last active
December 23, 2015 13:39
-
-
Save lu-zero/6643990 to your computer and use it in GitHub Desktop.
In case you need it to debug flvdec.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void amf_dump(AVFormatContext *s) | |
{ | |
AVIOContext *pb = s->pb; | |
int v; | |
char buf[1024]; | |
if (pb->eof_reached) | |
return; | |
switch ((v = avio_r8(pb))) { | |
case AMF_DATA_TYPE_NUMBER: | |
av_log(s, AV_LOG_DEBUG, " number %g\n", | |
av_int2double(avio_rb64(pb))); | |
break; | |
case AMF_DATA_TYPE_BOOL: | |
av_log(s, AV_LOG_DEBUG, " bool %d\n", avio_r8(pb)); | |
break; | |
case AMF_DATA_TYPE_STRING: | |
v = amf_get_string(pb, buf, sizeof(buf)); | |
if (v > 0) | |
av_log(s, AV_LOG_DEBUG, " string '%s'\n", buf); | |
break; | |
case AMF_DATA_TYPE_NULL: | |
av_log(s, AV_LOG_DEBUG, " NULL\n"); | |
break; | |
case AMF_DATA_TYPE_MIXEDARRAY: | |
avio_skip(pb, 4); | |
case AMF_DATA_TYPE_OBJECT: | |
av_log(s, AV_LOG_DEBUG, " {\n"); | |
do { | |
v = amf_get_string(pb, buf, sizeof(buf)); | |
if (v < 0) { | |
return; | |
} else if (v > 0) { | |
av_log(s, AV_LOG_DEBUG, " '%s' :", buf); | |
amf_dump(s); | |
} else | |
break; // End object reached | |
} while(1); | |
case AMF_DATA_TYPE_OBJECT_END: | |
av_log(s, AV_LOG_DEBUG, " }\n"); | |
break; | |
default: | |
av_log(s, AV_LOG_WARNING, "Unknown value %d", v); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment