Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2017/01/21 20:29:44... | ... |
@@ -483,6 +483,7 @@ library: |
483 | 483 |
@tab Output is performed by publishing stream to RTMP server |
484 | 484 |
@item RTP @tab X @tab X |
485 | 485 |
@item RTSP @tab X @tab X |
486 |
+@item Sample Dump eXchange @tab @tab X |
|
486 | 487 |
@item SAP @tab X @tab X |
487 | 488 |
@item SBG @tab @tab X |
488 | 489 |
@item SDP @tab @tab X |
... | ... |
@@ -437,6 +437,7 @@ OBJS-$(CONFIG_SBG_DEMUXER) += sbgdec.o |
437 | 437 |
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o |
438 | 438 |
OBJS-$(CONFIG_SDR2_DEMUXER) += sdr2.o |
439 | 439 |
OBJS-$(CONFIG_SDS_DEMUXER) += sdsdec.o |
440 |
+OBJS-$(CONFIG_SDX_DEMUXER) += sdxdec.o |
|
440 | 441 |
OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o |
441 | 442 |
OBJS-$(CONFIG_SEGMENT_MUXER) += segment.o |
442 | 443 |
OBJS-$(CONFIG_SHORTEN_DEMUXER) += shortendec.o rawdec.o |
... | ... |
@@ -276,6 +276,7 @@ void av_register_all(void) |
276 | 276 |
REGISTER_DEMUXER (SDP, sdp); |
277 | 277 |
REGISTER_DEMUXER (SDR2, sdr2); |
278 | 278 |
REGISTER_DEMUXER (SDS, sds); |
279 |
+ REGISTER_DEMUXER (SDX, sdx); |
|
279 | 280 |
#if CONFIG_RTPDEC |
280 | 281 |
ff_register_rtp_dynamic_payload_handlers(); |
281 | 282 |
ff_register_rdt_dynamic_payload_handlers(); |
282 | 283 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,90 @@ |
0 |
+/* |
|
1 |
+ * SDX demuxer |
|
2 |
+ * Copyright (c) 2017 Paul B Mahol |
|
3 |
+ * |
|
4 |
+ * This file is part of FFmpeg. |
|
5 |
+ * |
|
6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
8 |
+ * License as published by the Free Software Foundation; either |
|
9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
10 |
+ * |
|
11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
+ * Lesser General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+#include "libavutil/avstring.h" |
|
22 |
+#include "libavutil/intreadwrite.h" |
|
23 |
+#include "avformat.h" |
|
24 |
+#include "internal.h" |
|
25 |
+#include "pcm.h" |
|
26 |
+ |
|
27 |
+static int sdx_probe(AVProbeData *p) |
|
28 |
+{ |
|
29 |
+ if (AV_RB32(p->buf) == AV_RB32("SDX:")) |
|
30 |
+ return AVPROBE_SCORE_EXTENSION; |
|
31 |
+ return 0; |
|
32 |
+} |
|
33 |
+ |
|
34 |
+static int sdx_read_header(AVFormatContext *s) |
|
35 |
+{ |
|
36 |
+ AVStream *st; |
|
37 |
+ int depth, length; |
|
38 |
+ |
|
39 |
+ avio_skip(s->pb, 4); |
|
40 |
+ while (!avio_feof(s->pb)) { |
|
41 |
+ if (avio_r8(s->pb) == 0x1a) |
|
42 |
+ break; |
|
43 |
+ } |
|
44 |
+ if (avio_r8(s->pb) != 1) |
|
45 |
+ return AVERROR_INVALIDDATA; |
|
46 |
+ length = avio_r8(s->pb); |
|
47 |
+ avio_skip(s->pb, length); |
|
48 |
+ avio_skip(s->pb, 4); |
|
49 |
+ depth = avio_r8(s->pb); |
|
50 |
+ |
|
51 |
+ st = avformat_new_stream(s, NULL); |
|
52 |
+ if (!st) |
|
53 |
+ return AVERROR(ENOMEM); |
|
54 |
+ |
|
55 |
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
|
56 |
+ st->codecpar->channels = 1; |
|
57 |
+ st->codecpar->sample_rate = avio_rl32(s->pb); |
|
58 |
+ switch (depth) { |
|
59 |
+ case 8: |
|
60 |
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; |
|
61 |
+ break; |
|
62 |
+ case 16: |
|
63 |
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_U16LE; |
|
64 |
+ break; |
|
65 |
+ case 24: |
|
66 |
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_U24LE; |
|
67 |
+ break; |
|
68 |
+ case 32: |
|
69 |
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_U32LE; |
|
70 |
+ break; |
|
71 |
+ default: |
|
72 |
+ return AVERROR_INVALIDDATA; |
|
73 |
+ } |
|
74 |
+ avio_skip(s->pb, 16); |
|
75 |
+ st->codecpar->block_align = depth / 8; |
|
76 |
+ |
|
77 |
+ return 0; |
|
78 |
+} |
|
79 |
+ |
|
80 |
+AVInputFormat ff_sdx_demuxer = { |
|
81 |
+ .name = "sdx", |
|
82 |
+ .long_name = NULL_IF_CONFIG_SMALL("Sample Dump eXchange"), |
|
83 |
+ .read_probe = sdx_probe, |
|
84 |
+ .read_header = sdx_read_header, |
|
85 |
+ .read_packet = ff_pcm_read_packet, |
|
86 |
+ .read_seek = ff_pcm_read_seek, |
|
87 |
+ .extensions = "sdx", |
|
88 |
+ .flags = AVFMT_GENERIC_INDEX, |
|
89 |
+}; |
... | ... |
@@ -32,7 +32,7 @@ |
32 | 32 |
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) |
33 | 33 |
// Also please add any ticket numbers that you believe might be affected here |
34 | 34 |
#define LIBAVFORMAT_VERSION_MAJOR 57 |
35 |
-#define LIBAVFORMAT_VERSION_MINOR 63 |
|
35 |
+#define LIBAVFORMAT_VERSION_MINOR 64 |
|
36 | 36 |
#define LIBAVFORMAT_VERSION_MICRO 100 |
37 | 37 |
|
38 | 38 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |