summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec.c21
-rw-r--r--libavformat/rtpdec_asf.c5
-rw-r--r--libavformat/utils.c4
3 files changed, 27 insertions, 3 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index d09f3882c6..6bcfe0ac34 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -26,6 +26,7 @@
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@@ -35,6 +36,7 @@
#include "avlanguage.h"
typedef struct {
+ const AVClass *class;
int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID
ASFStream streams[128]; ///< it's max number and it's not that big
uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming)
@@ -72,8 +74,22 @@ typedef struct {
int stream_index;
ASFStream* asf_st; ///< currently decoded stream
+
+ int no_resync_search;
} ASFContext;
+static const AVOption options[] = {
+ {"no_resync_search", "Don't try to resynchronize by looking for a certain optional start code", offsetof(ASFContext, no_resync_search), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass asf_class = {
+ .class_name = "asf demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
#undef NDEBUG
#include <assert.h>
@@ -713,7 +729,9 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
// if we do not know packet size, allow skipping up to 32 kB
off= 32768;
- if (s->packet_size > 0)
+ if (asf->no_resync_search)
+ off = 3;
+ else if (s->packet_size > 0)
off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
c=d=e=-1;
@@ -1302,4 +1320,5 @@ AVInputFormat ff_asf_demuxer = {
.read_seek = asf_read_seek,
.read_timestamp = asf_read_pts,
.flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
+ .priv_class = &asf_class,
};
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 53c2bcef71..65b466669d 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -99,6 +99,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
AVIOContext pb;
RTSPState *rt = s->priv_data;
+ AVDictionary *opts = NULL;
int len = strlen(p) * 6 / 8;
char *buf = av_mallocz(len);
av_base64_decode(buf, p, len);
@@ -113,7 +114,9 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
if (!(rt->asf_ctx = avformat_alloc_context()))
return AVERROR(ENOMEM);
rt->asf_ctx->pb = &pb;
- ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, NULL);
+ av_dict_set(&opts, "no_resync_search", "1", 0);
+ ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, &opts);
+ av_dict_free(&opts);
if (ret < 0)
return ret;
av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1ab8035d90..ebf34deff8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2483,7 +2483,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
break;
if(st->parser && st->parser->parser->split && !st->codec->extradata)
break;
- if(st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
+ if (st->first_dts == AV_NOPTS_VALUE &&
+ (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+ st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
break;
}
if (i == ic->nb_streams) {