aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-05 21:23:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-05 21:55:31 +0200
commit24823a761cb28eff5876d5de266a7d7103075e94 (patch)
treea476ad08e498a91e05f8a2b789bf6b4f495a145d /libavformat
parent92c7ef1e30d677f29c06caf765c527c9db486861 (diff)
parentbb58c43c69078c6cf29a9efee12e14469e2c21f8 (diff)
downloadffmpeg-24823a761cb28eff5876d5de266a7d7103075e94.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: qdm2: remove broken and disabled dump_context() debug function x86: h264_intrapred: use newly introduced SPLAT* and PSHUFLW macros x86inc: add SPLATB_LOAD, SPLATB_REG, PSHUFLW macros x86inc: modify ALIGN to not generate long nops on i586 x86: h264_intrapred: port to cpuflag macros avplay: update input filter pointer when the filtergraph is reset. avconv: fix parsing of -force_key_frames option. h264: use templates to avoid excessive inlining xtea: Make the count parameter match the documentation blowfish: Make the count parameter match the documentation mpegvideo: Don't use ff_mspel_motion() for vc1 xtea: invert branch and loop precedence blowfish: invert branch and loop precedence flvdec: optionally trust the metadata avconv: Set audio filter time base to the sample rate vp8: Add ifdef guards around the sse2 loopfilter in the sse2slow branch too Conflicts: ffmpeg.c ffplay.c libavcodec/h264.c libavcodec/mpegvideo_common.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/flvdec.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 302e7b687f..b65af892fb 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -26,6 +26,7 @@
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
+#include "libavutil/opt.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
@@ -38,6 +39,8 @@
#define VALIDATE_INDEX_TS_THRESH 2500
typedef struct {
+ const AVClass *class; ///< Class for private options.
+ int trust_metadata; ///< configure streams according onMetaData
int wrong_dts; ///< wrong dts due to negative cts
uint8_t *new_extradata[FLV_STREAM_TYPE_NB];
int new_extradata_size[FLV_STREAM_TYPE_NB];
@@ -327,6 +330,7 @@ finish:
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
AVCodecContext *acodec, *vcodec;
+ FLVContext *flv = s->priv_data;
AVIOContext *ioc;
AMFDataType amf_type;
char str_val[256];
@@ -406,6 +410,22 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_id = CODEC_ID_TEXT;
+ } else if (flv->trust_metadata) {
+ if (!strcmp(key, "videocodecid") && vcodec) {
+ flv_set_video_codec(s, vstream, num_val);
+ } else
+ if (!strcmp(key, "audiocodecid") && acodec) {
+ flv_set_audio_codec(s, astream, acodec, num_val);
+ } else
+ if (!strcmp(key, "audiosamplerate") && acodec) {
+ acodec->sample_rate = num_val;
+ } else
+ if (!strcmp(key, "width") && vcodec) {
+ vcodec->width = num_val;
+ } else
+ if (!strcmp(key, "height") && vcodec) {
+ vcodec->height = num_val;
+ }
}
}
@@ -857,6 +877,20 @@ static int flv_read_seek(AVFormatContext *s, int stream_index,
return avio_seek_time(s->pb, stream_index, ts, flags);
}
+#define OFFSET(x) offsetof(FLVContext, x)
+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption options[] = {
+ { "flv_metadata", "Allocate streams according the onMetaData array", OFFSET(trust_metadata), AV_OPT_TYPE_INT, { 0 }, 0, 1, VD},
+ { NULL }
+};
+
+static const AVClass class = {
+ .class_name = "flvdec",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVInputFormat ff_flv_demuxer = {
.name = "flv",
.long_name = NULL_IF_CONFIG_SMALL("FLV format"),
@@ -867,4 +901,5 @@ AVInputFormat ff_flv_demuxer = {
.read_seek = flv_read_seek,
.read_close = flv_read_close,
.extensions = "flv",
+ .priv_class = &class,
};