Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2016/03/27 20:02:33... | ... |
@@ -17,6 +17,7 @@ version <next>: |
17 | 17 |
- AudioToolbox audio encoders |
18 | 18 |
- coreimage filter (GPU based image filtering on OSX) |
19 | 19 |
- libdcadec removed |
20 |
+- bitstream filter for extracting DTS core |
|
20 | 21 |
|
21 | 22 |
version 3.0: |
22 | 23 |
- Common Encryption (CENC) MP4 encoding and decoding support |
... | ... |
@@ -67,6 +67,10 @@ the header stored in extradata to the key packets: |
67 | 67 |
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts |
68 | 68 |
@end example |
69 | 69 |
|
70 |
+@section dca_core |
|
71 |
+ |
|
72 |
+Extract DCA core from DTS-HD streams. |
|
73 |
+ |
|
70 | 74 |
@section h264_mp4toannexb |
71 | 75 |
|
72 | 76 |
Convert an H.264 bitstream from length prefixed mode to start code |
... | ... |
@@ -924,6 +924,7 @@ OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \ |
924 | 924 |
mpeg4audio.o |
925 | 925 |
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o |
926 | 926 |
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o |
927 |
+OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o |
|
927 | 928 |
OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o |
928 | 929 |
OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o |
929 | 930 |
OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o |
... | ... |
@@ -670,6 +670,7 @@ void avcodec_register_all(void) |
670 | 670 |
REGISTER_BSF(AAC_ADTSTOASC, aac_adtstoasc); |
671 | 671 |
REGISTER_BSF(CHOMP, chomp); |
672 | 672 |
REGISTER_BSF(DUMP_EXTRADATA, dump_extradata); |
673 |
+ REGISTER_BSF(DCA_CORE, dca_core); |
|
673 | 674 |
REGISTER_BSF(H264_MP4TOANNEXB, h264_mp4toannexb); |
674 | 675 |
REGISTER_BSF(HEVC_MP4TOANNEXB, hevc_mp4toannexb); |
675 | 676 |
REGISTER_BSF(IMX_DUMP_HEADER, imx_dump_header); |
676 | 677 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,60 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2016 Paul B Mahol |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "avcodec.h" |
|
21 |
+#include "bytestream.h" |
|
22 |
+#include "dca_syncwords.h" |
|
23 |
+#include "libavutil/mem.h" |
|
24 |
+ |
|
25 |
+static int dca_core(AVBitStreamFilterContext *bsfc, |
|
26 |
+ AVCodecContext *avctx, const char *args, |
|
27 |
+ uint8_t **poutbuf, int *poutbuf_size, |
|
28 |
+ const uint8_t *buf, int buf_size, |
|
29 |
+ int keyframe) |
|
30 |
+{ |
|
31 |
+ GetByteContext gb; |
|
32 |
+ uint32_t syncword; |
|
33 |
+ int core_size = 0; |
|
34 |
+ |
|
35 |
+ bytestream2_init(&gb, buf, buf_size); |
|
36 |
+ syncword = bytestream2_get_be32(&gb); |
|
37 |
+ bytestream2_skip(&gb, 1); |
|
38 |
+ |
|
39 |
+ switch (syncword) { |
|
40 |
+ case DCA_SYNCWORD_CORE_BE: |
|
41 |
+ core_size = ((bytestream2_get_be24(&gb) >> 4) & 0x3fff) + 1; |
|
42 |
+ break; |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ *poutbuf = (uint8_t *)buf; |
|
46 |
+ |
|
47 |
+ if (core_size > 0 && core_size <= buf_size) { |
|
48 |
+ *poutbuf_size = core_size; |
|
49 |
+ } else { |
|
50 |
+ *poutbuf_size = buf_size; |
|
51 |
+ } |
|
52 |
+ |
|
53 |
+ return 0; |
|
54 |
+} |
|
55 |
+ |
|
56 |
+AVBitStreamFilter ff_dca_core_bsf = { |
|
57 |
+ .name = "dca_core", |
|
58 |
+ .filter = dca_core, |
|
59 |
+}; |
... | ... |
@@ -28,7 +28,7 @@ |
28 | 28 |
#include "libavutil/version.h" |
29 | 29 |
|
30 | 30 |
#define LIBAVCODEC_VERSION_MAJOR 57 |
31 |
-#define LIBAVCODEC_VERSION_MINOR 31 |
|
31 |
+#define LIBAVCODEC_VERSION_MINOR 32 |
|
32 | 32 |
#define LIBAVCODEC_VERSION_MICRO 100 |
33 | 33 |
|
34 | 34 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |