aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2009-07-06 21:54:37 +0000
committerAurelien Jacobs <aurel@gnuage.org>2009-07-06 21:54:37 +0000
commitdf2bd71aeb3e68509e3afc5502ef7cd6e5a69583 (patch)
tree65b3f85f5e14e68a27310fe189b9c13a22cc1e00
parent09e54e1ff8c977376fc84e436350f054697e2e10 (diff)
downloadffmpeg-df2bd71aeb3e68509e3afc5502ef7cd6e5a69583.tar.gz
flvdec: expose metadata through the generic metadata API
original patch from Art Clarke aclarke _at_ xuggle _dot_ com Originally committed as revision 19364 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/flvdec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8fdc365532..9505487aa8 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -24,6 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/avstring.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
@@ -218,11 +219,16 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
vcodec = vstream ? vstream->codec : NULL;
if(amf_type == AMF_DATA_TYPE_BOOL) {
+ av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val));
+ av_metadata_set(&s->metadata, key, str_val);
} else if(amf_type == AMF_DATA_TYPE_NUMBER) {
+ snprintf(str_val, sizeof(str_val), "%.f", num_val);
+ av_metadata_set(&s->metadata, key, str_val);
if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE;
else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
vcodec->bit_rate = num_val * 1024.0;
- }
+ } else if (amf_type == AMF_DATA_TYPE_STRING)
+ av_metadata_set(&s->metadata, key, str_val);
}
return 0;