summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-03 02:01:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-03 02:16:26 +0100
commit988f585fcb1cfb40fe4b706c32b31594b536bba0 (patch)
tree659b8d9f4daf4ce497b42c83f7adb45725fa4f65 /libavformat
parent0b3e9d5dc61bb705d93db1e87d78d8d5131905c6 (diff)
parent594b54b51e9f3af8aac18184d634b85a836b42b6 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (44 commits) replacement Indeo 3 decoder gsm demuxer: do not allocate packet twice. flvenc: use first packet delay as global delay. ac3enc: doxygen update. imc: return error codes instead of 0 for error conditions. imc: return meaningful error codes instead of -1 imc: do not set channel layout for stereo imc: validate channel count imc: check for ff_fft_init() failure imc: check output buffer size before decoding imc: use DSPContext.bswap16_buf() to byte-swap packet data rtsp: add allowed_media_types option libgsm: add flush function to reset the decoder state when seeking libgsm: simplify decoding by using a loop gsm: log error message when packet is too small libgsmdec: do not needlessly set *data_size to 0 gsmdec: do not needlessly set *data_size to 0 gsmdec: add flush function to reset the decoder state when seeking libgsmdec: check output buffer size before decoding gsmdec: log error message when output buffer is too small. ... Conflicts: Changelog ffplay.c libavcodec/indeo3.c libavcodec/mjpeg_parser.c libavcodec/vp3.c libavformat/cutils.c libavformat/id3v2.c libavutil/parseutils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile2
-rw-r--r--libavformat/asfdec.c2
-rw-r--r--libavformat/au.c2
-rw-r--r--libavformat/avio.c2
-rw-r--r--libavformat/aviobuf.c2
-rw-r--r--libavformat/avisynth.c2
-rw-r--r--libavformat/cutils.c2
-rw-r--r--libavformat/dv.c2
-rw-r--r--libavformat/file.c2
-rw-r--r--libavformat/flvenc.c17
-rw-r--r--libavformat/gsmdec.c132
-rw-r--r--libavformat/id3v2.c2
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/os_support.c2
-rw-r--r--libavformat/os_support.h2
-rw-r--r--libavformat/rawdec.c12
-rw-r--r--libavformat/riff.c17
-rw-r--r--libavformat/rso.h2
-rw-r--r--libavformat/rtsp.c12
-rw-r--r--libavformat/rtsp.h5
20 files changed, 184 insertions, 39 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 0f35593c9d..3d471c28f2 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -93,7 +93,7 @@ OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o
OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o
OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o
OBJS-$(CONFIG_GIF_MUXER) += gif.o
-OBJS-$(CONFIG_GSM_DEMUXER) += rawdec.o
+OBJS-$(CONFIG_GSM_DEMUXER) += gsmdec.o
OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o
OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o
OBJS-$(CONFIG_G722_DEMUXER) += rawdec.o
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 88cc3d59f9..6cd771ee89 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -358,7 +358,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
/* Extract palette from extradata if bpp <= 8 */
/* This code assumes that extradata contains only palette */
- /* This is true for all paletted codecs implemented in ffmpeg */
+ /* This is true for all paletted codecs implemented in libavcodec */
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
int av_unused i;
#if HAVE_BIGENDIAN
diff --git a/libavformat/au.c b/libavformat/au.c
index af00e6d4ff..610880d842 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -35,7 +35,7 @@
/* if we don't know the size in advance */
#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
-/* The ffmpeg codecs we support, and the IDs they have in the file */
+/* The libavcodec codecs we support, and the IDs they have in the file */
static const AVCodecTag codec_au_tags[] = {
{ CODEC_ID_PCM_MULAW, 1 },
{ CODEC_ID_PCM_S8, 2 },
diff --git a/libavformat/avio.c b/libavformat/avio.c
index b2926c0f3c..2bdad73d88 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -1,5 +1,5 @@
/*
- * Unbuffered io for ffmpeg system
+ * unbuffered I/O
* Copyright (c) 2001 Fabrice Bellard
*
* This file is part of FFmpeg.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 9fc555ee53..91a91db630 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1,5 +1,5 @@
/*
- * Buffered I/O for ffmpeg system
+ * buffered I/O
* Copyright (c) 2000,2001 Fabrice Bellard
*
* This file is part of FFmpeg.
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 3e7dd46924..b3f4a41a39 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -1,5 +1,5 @@
/*
- * AVISynth support for ffmpeg system
+ * AVISynth support
* Copyright (c) 2006 DivX, Inc.
*
* This file is part of FFmpeg.
diff --git a/libavformat/cutils.c b/libavformat/cutils.c
index 76aba56150..22be2c3384 100644
--- a/libavformat/cutils.c
+++ b/libavformat/cutils.c
@@ -1,5 +1,5 @@
/*
- * Various simple utilities for ffmpeg system
+ * various simple utilities for libavformat
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 378f29f0f3..f69be87755 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -96,7 +96,7 @@ static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
/*
* There's a couple of assumptions being made here:
* 1. By default we silence erroneous (0x8000/16bit 0x800/12bit) audio samples.
- * We can pass them upwards when ffmpeg will be ready to deal with them.
+ * We can pass them upwards when libavcodec will be ready to deal with them.
* 2. We don't do software emphasis.
* 3. Audio is always returned as 16bit linear samples: 12bit nonlinear samples
* are converted into 16bit linear ones.
diff --git a/libavformat/file.c b/libavformat/file.c
index ffbccba0a4..1352bcc546 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -1,5 +1,5 @@
/*
- * Buffered file io for ffmpeg system
+ * buffered file I/O
* Copyright (c) 2001 Fabrice Bellard
*
* This file is part of FFmpeg.
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 627bb6d3ab..5e86640c3e 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -60,10 +60,10 @@ typedef struct FLVContext {
int64_t duration_offset;
int64_t filesize_offset;
int64_t duration;
+ int64_t delay; ///< first dts delay (needed for AVC & Speex)
} FLVContext;
typedef struct FLVStreamContext {
- int delay; ///< first dts delay for each stream (needed for AVC & Speex)
int64_t last_ts; ///< last timestamp for each stream
} FLVStreamContext;
@@ -210,6 +210,8 @@ static int flv_write_header(AVFormatContext *s)
s->streams[i]->priv_data = sc;
sc->last_ts = -1;
}
+ flv->delay = AV_NOPTS_VALUE;
+
avio_write(pb, "FLV", 3);
avio_w8(pb,1);
avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
@@ -444,10 +446,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
return -1;
}
- if (!sc->delay && pkt->dts < 0)
- sc->delay = -pkt->dts;
+ if (flv->delay == AV_NOPTS_VALUE)
+ flv->delay = -pkt->dts;
+ if (pkt->dts < -flv->delay) {
+ av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with "
+ "respect to DTS\n");
+ return AVERROR(EINVAL);
+ }
- ts = pkt->dts + sc->delay; // add delay to force positive dts
+ ts = pkt->dts + flv->delay; // add delay to force positive dts
/* check Speex packet duration */
if (enc->codec_id == CODEC_ID_SPEEX && ts - sc->last_ts > 160) {
@@ -481,7 +488,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb, data ? data : pkt->data, size);
avio_wb32(pb,size+flags_size+11); // previous tag size
- flv->duration = FFMAX(flv->duration, pkt->pts + sc->delay + pkt->duration);
+ flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
avio_flush(pb);
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
new file mode 100644
index 0000000000..8c73c7b447
--- /dev/null
+++ b/libavformat/gsmdec.c
@@ -0,0 +1,132 @@
+/*
+ * RAW GSM demuxer
+ * Copyright (c) 2011 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "avformat.h"
+
+#define GSM_BLOCK_SIZE 33
+#define GSM_BLOCK_SAMPLES 160
+#define GSM_SAMPLE_RATE 8000
+
+typedef struct {
+ AVClass *class;
+ int sample_rate;
+} GSMDemuxerContext;
+
+static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ int ret, size;
+
+ size = GSM_BLOCK_SIZE * 32;
+
+ pkt->pos = avio_tell(s->pb);
+ pkt->stream_index = 0;
+
+ ret = av_get_packet(s->pb, pkt, size);
+ if (ret < GSM_BLOCK_SIZE) {
+ av_free_packet(pkt);
+ return ret < 0 ? ret : AVERROR(EIO);
+ }
+ pkt->size = ret;
+ pkt->duration = ret / GSM_BLOCK_SIZE;
+ pkt->pts = pkt->pos / GSM_BLOCK_SIZE;
+
+ return 0;
+}
+
+static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
+{
+ GSMDemuxerContext *c = s->priv_data;
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = s->iformat->value;
+ st->codec->channels = 1;
+ st->codec->sample_rate = c->sample_rate;
+ st->codec->block_align = GSM_BLOCK_SIZE;
+ st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
+
+ av_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE);
+
+ return 0;
+}
+
+static int gsm_read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts,
+ int64_t ts, int64_t max_ts, int flags)
+{
+ GSMDemuxerContext *c = s->priv_data;
+
+ /* convert timestamps to file positions */
+ if (!(flags & AVSEEK_FLAG_BYTE)) {
+ if (stream_index < 0) {
+ AVRational bitrate_q = { GSM_BLOCK_SAMPLES, c->sample_rate * GSM_BLOCK_SIZE };
+ ts = av_rescale_q(ts, AV_TIME_BASE_Q, bitrate_q);
+ min_ts = av_rescale_q(min_ts, AV_TIME_BASE_Q, bitrate_q);
+ max_ts = av_rescale_q(max_ts, AV_TIME_BASE_Q, bitrate_q);
+ } else {
+ ts *= GSM_BLOCK_SIZE;
+ min_ts *= GSM_BLOCK_SIZE;
+ max_ts *= GSM_BLOCK_SIZE;
+ }
+ }
+ /* round to nearest block boundary */
+ ts = (ts + GSM_BLOCK_SIZE / 2) / GSM_BLOCK_SIZE * GSM_BLOCK_SIZE;
+ ts = FFMAX(0, ts);
+
+ /* handle min/max */
+ while (ts < min_ts)
+ ts += GSM_BLOCK_SIZE;
+ while (ts > max_ts)
+ ts -= GSM_BLOCK_SIZE;
+ if (ts < min_ts || ts > max_ts)
+ return -1;
+
+ return avio_seek(s->pb, ts, SEEK_SET);
+}
+
+static const AVOption options[] = {
+ { "sample_rate", "", offsetof(GSMDemuxerContext, sample_rate),
+ AV_OPT_TYPE_INT, {.dbl = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE,
+ AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass class = {
+ .class_name = "gsm demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVInputFormat ff_gsm_demuxer = {
+ .name = "gsm",
+ .long_name = NULL_IF_CONFIG_SMALL("raw GSM"),
+ .priv_data_size = sizeof(GSMDemuxerContext),
+ .read_header = gsm_read_header,
+ .read_packet = gsm_read_packet,
+ .read_seek2 = gsm_read_seek2,
+ .extensions = "gsm",
+ .value = CODEC_ID_GSM,
+ .priv_class = &class,
+};
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 32870648cf..4d44c3c269 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -392,7 +392,7 @@ typedef struct ID3v2EMFunc {
const char *tag3;
const char *tag4;
void (*read)(AVFormatContext*, AVIOContext*, int, char*, ID3v2ExtraMeta **);
- void (*free)(void *);
+ void (*free)(void *obj);
} ID3v2EMFunc;
static const ID3v2EMFunc id3v2_extra_meta_funcs[] = {
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 40979a6fdf..e4daa7c332 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1475,7 +1475,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (pid < 0)
break;
- /* now create ffmpeg stream */
+ /* now create stream */
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
pes = ts->pids[pid]->u.pes_filter.opaque;
if (!pes->st) {
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index ac9086c3c3..a242693cc1 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -1,5 +1,5 @@
/*
- * Various utilities for ffmpeg system
+ * various OS-feature replacement utilities
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
* copyright (c) 2002 Francois Revol
*
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index f770528365..fca5b2a813 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -1,5 +1,5 @@
/*
- * various utilities for ffmpeg system
+ * various OS-feature replacement utilities
* copyright (c) 2000, 2001, 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index a270ccd469..d497f12e64 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -193,18 +193,6 @@ AVInputFormat ff_g722_demuxer = {
};
#endif
-#if CONFIG_GSM_DEMUXER
-AVInputFormat ff_gsm_demuxer = {
- .name = "gsm",
- .long_name = NULL_IF_CONFIG_SMALL("raw GSM"),
- .read_header = ff_raw_audio_read_header,
- .read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "gsm",
- .value = CODEC_ID_GSM,
-};
-#endif
-
#if CONFIG_LATM_DEMUXER
AVInputFormat ff_latm_demuxer = {
.name = "latm",
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 7492df7c0b..aea6eba112 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -400,11 +400,13 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
avio_wl32(pb, enc->sample_rate);
if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
bps = 0;
- } else if (enc->codec_id == CODEC_ID_ADPCM_G726) {
- bps = 4;
} else {
- if (!(bps = av_get_bits_per_sample(enc->codec_id)))
- bps = 16; // default to 16
+ if (!(bps = av_get_bits_per_sample(enc->codec_id))) {
+ if (enc->bits_per_coded_sample)
+ bps = enc->bits_per_coded_sample;
+ else
+ bps = 16; // default to 16
+ }
}
if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){
av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps);
@@ -415,12 +417,10 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
//blkalign = 144 * enc->bit_rate/enc->sample_rate;
} else if (enc->codec_id == CODEC_ID_AC3) {
blkalign = 3840; //maximum bytes per frame
- } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { //
- blkalign = 1;
} else if (enc->block_align != 0) { /* specified by the codec */
blkalign = enc->block_align;
} else
- blkalign = enc->channels*bps >> 3;
+ blkalign = bps * enc->channels / av_gcd(8, bps);
if (enc->codec_id == CODEC_ID_PCM_U8 ||
enc->codec_id == CODEC_ID_PCM_S24LE ||
enc->codec_id == CODEC_ID_PCM_S32LE ||
@@ -572,6 +572,9 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
codec->channels = 0;
codec->sample_rate = 0;
}
+ /* override bits_per_coded_sample for G.726 */
+ if (codec->codec_id == CODEC_ID_ADPCM_G726)
+ codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate;
return 0;
}
diff --git a/libavformat/rso.h b/libavformat/rso.h
index acb0f14063..1f65dd90c7 100644
--- a/libavformat/rso.h
+++ b/libavformat/rso.h
@@ -26,7 +26,7 @@
#define RSO_HEADER_SIZE 8
-/* The ffmpeg codecs we support, and the IDs they have in the file */
+/* The libavcodec codecs we support, and the IDs they have in the file */
extern const AVCodecTag ff_codec_rso_tags[];
#endif /* AVFORMAT_RSO_H */
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 11533968eb..a80a9da7bf 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -65,6 +65,12 @@
{ name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
{ "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }
+#define RTSP_MEDIATYPE_OPTS(name, longname) \
+ { name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
+ { "video", "Video", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \
+ { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \
+ { "data", "Data", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" }
+
const AVOption ff_rtsp_options[] = {
{ "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC },
FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
@@ -74,11 +80,13 @@ const AVOption ff_rtsp_options[] = {
{ "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" },
{ "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"),
+ RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
{ NULL },
};
static const AVOption sdp_options[] = {
RTSP_FLAG_OPTS("sdp_flags", "SDP flags"),
+ RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
{ NULL },
};
@@ -325,6 +333,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
case 'm':
/* new stream */
s1->skip_media = 0;
+ codec_type = AVMEDIA_TYPE_UNKNOWN;
get_word(st_type, sizeof(st_type), &p);
if (!strcmp(st_type, "audio")) {
codec_type = AVMEDIA_TYPE_AUDIO;
@@ -332,7 +341,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
codec_type = AVMEDIA_TYPE_VIDEO;
} else if (!strcmp(st_type, "application")) {
codec_type = AVMEDIA_TYPE_DATA;
- } else {
+ }
+ if (codec_type == AVMEDIA_TYPE_UNKNOWN || !(rt->media_type_mask & (1 << codec_type))) {
s1->skip_media = 1;
return;
}
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index da61829da2..707750409f 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -354,6 +354,11 @@ typedef struct RTSPState {
* Various option flags for the RTSP muxer/demuxer.
*/
int rtsp_flags;
+
+ /**
+ * Mask of all requested media types
+ */
+ int media_type_mask;
} RTSPState;
#define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets -