Skip to content

Instantly share code, notes, and snippets.

@lu-zero
Last active December 23, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lu-zero/6643990 to your computer and use it in GitHub Desktop.
Save lu-zero/6643990 to your computer and use it in GitHub Desktop.
In case you need it to debug flvdec.c
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