summaryrefslogtreecommitdiff
path: root/libavformat/rawdec.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-04-29 20:46:00 +0200
committerNicolas George <nicolas.george@normalesup.org>2013-05-01 11:56:34 +0200
commit276fcbde6c5532a02aacd2e2d31beaa8d4e79a8a (patch)
tree4be6e1184e3add477dd4daae5de6ede40e2ec8cc /libavformat/rawdec.c
parent3319679d0a36bec3e78f639d6f9fbbe596f6eec3 (diff)
downloadffmpeg-276fcbde6c5532a02aacd2e2d31beaa8d4e79a8a.tar.gz
lavf: data muxer and demuxer.
Allow to use tools designed to work with demuxers, muxers and packets (for example ffmpeg itself) to process raw byte streams (like aviocat).
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r--libavformat/rawdec.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 153cc7b04e..a9ff22ae18 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -90,6 +90,17 @@ fail:
return ret;
}
+static int ff_raw_data_read_header(AVFormatContext *s)
+{
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ st->codec->codec_type = AVMEDIA_TYPE_DATA;
+ st->codec->codec_id = s->iformat->raw_codec_id;
+ st->start_time = 0;
+ return 0;
+}
+
/* Note: Do not forget to add new entries to the Makefile as well. */
#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
@@ -99,6 +110,16 @@ const AVOption ff_rawvideo_options[] = {
{ NULL },
};
+#if CONFIG_DATA_DEMUXER
+AVInputFormat ff_data_demuxer = {
+ .name = "data",
+ .long_name = NULL_IF_CONFIG_SMALL("raw data"),
+ .read_header = ff_raw_data_read_header,
+ .read_packet = ff_raw_read_partial_packet,
+ .raw_codec_id = AV_CODEC_ID_NONE,
+};
+#endif
+
#if CONFIG_LATM_DEMUXER
AVInputFormat ff_latm_demuxer = {
.name = "latm",