Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-14 Thread Carl Eugen Hoyos
2018-01-14 14:08 GMT+01:00 Aurelien Jacobs :

> Here is an updated version to match the single codec ID
> version of the encoder / decoder, by using codec_tag.

Please do not set the codec_tag field in the context that a
value that was invented within FFmpeg.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-14 Thread Aurelien Jacobs
On Sun, Jan 07, 2018 at 04:55:43PM +0100, Aurelien Jacobs wrote:
> On Sun, Jan 07, 2018 at 12:53:27AM +0100, Michael Niedermayer wrote:
> > On Sat, Jan 06, 2018 at 05:48:08PM +0100, Aurelien Jacobs wrote:
> > > ---
> > >  Changelog|  2 +-
> > >  libavformat/Makefile |  2 ++
> > >  libavformat/allformats.c |  1 +
> > >  libavformat/aptxdec.c| 51 
> > > 
> > >  libavformat/rawenc.c | 13 
> > >  5 files changed, 64 insertions(+), 5 deletions(-)
> > [...]
> > > @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = {
> > >  .version= LIBAVUTIL_VERSION_INT,
> > >  };
> > >  
> > > +#if CONFIG_APTX_MUXER
> > >  AVInputFormat ff_aptx_demuxer = {
> > >  .name   = "aptx",
> > >  .long_name  = NULL_IF_CONFIG_SMALL("raw aptX"),
> > > @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = {
> > >  .flags  = AVFMT_GENERIC_INDEX,
> > 
> > >  .priv_class = _demuxer_class,
> > [...]
> > > +.priv_class = _demuxer_class,
> > 
> > this cause the code (for example fate) to infinite loop
> 
> Oh, indeed, it seems 2 demuxers can't share the same priv_class.
> Here is an updated patch.

Here is an updated version to match the single codec ID version of the
encoder / decoder, by using codec_tag.
>From a63645428b4d8332f5389dfe0f66229a5bfe8058 Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs 
Date: Sat, 6 Jan 2018 17:33:01 +0100
Subject: [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

---
 Changelog|  2 +-
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  1 +
 libavformat/aptxdec.c| 68 +---
 libavformat/rawenc.c | 33 ++-
 5 files changed, 100 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index 9349bf1e8d..3a97b0b02e 100644
--- a/Changelog
+++ b/Changelog
@@ -12,7 +12,7 @@ version :
 - Intel QSV-accelerated MJPEG encoding
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX and aptX HD encoder and decoder
-- Raw aptX muxer and demuxer
+- Raw aptX and aptX HD muxer and demuxer
 - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cb70eac920..dbe2890297 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -96,6 +96,8 @@ OBJS-$(CONFIG_APNG_DEMUXER)  += apngdec.o
 OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_APTX_DEMUXER)  += aptxdec.o rawdec.o
 OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o
+OBJS-$(CONFIG_APTX_HD_DEMUXER)   += aptxdec.o rawdec.o
+OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec_f.o asf.o asfcrypt.o \
 avlanguage.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a9b9883c9..b70b7463b9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -70,6 +70,7 @@ static void register_all(void)
 REGISTER_DEMUXER (APE,  ape);
 REGISTER_MUXDEMUX(APNG, apng);
 REGISTER_MUXDEMUX(APTX, aptx);
+REGISTER_MUXDEMUX(APTX_HD,  aptx_hd);
 REGISTER_DEMUXER (AQTITLE,  aqtitle);
 REGISTER_MUXDEMUX(ASF,  asf);
 REGISTER_DEMUXER (ASF_O,asf_o);
diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c
index 3b8fae1b55..dfa07337b6 100644
--- a/libavformat/aptxdec.c
+++ b/libavformat/aptxdec.c
@@ -26,26 +26,59 @@
 #define APTX_BLOCK_SIZE   4
 #define APTX_PACKET_SIZE  (256*APTX_BLOCK_SIZE)
 
+#define APTX_HD_BLOCK_SIZE   6
+#define APTX_HD_PACKET_SIZE  (256*APTX_HD_BLOCK_SIZE)
+
+#define A2DP_VENDOR_ID_APT  0x004F
+#define A2DP_APT_CODEC_ID_APTX  0x0001
+
+#define A2DP_VENDOR_ID_QUALCOMM 0x00D7
+#define A2DP_QUALCOMM_CODEC_ID_APTX_HD  0x0024
+
 typedef struct AptXDemuxerContext {
 AVClass *class;
 int sample_rate;
 } AptXDemuxerContext;
 
-static int aptx_read_header(AVFormatContext *s)
+static AVStream *aptx_read_header_common(AVFormatContext *s)
 {
 AptXDemuxerContext *s1 = s->priv_data;
 AVStream *st = avformat_new_stream(s, NULL);
 if (!st)
-return AVERROR(ENOMEM);
+return NULL;
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-st->codecpar->codec_id = AV_CODEC_ID_APTX;
 st->codecpar->format = AV_SAMPLE_FMT_S32P;
 st->codecpar->channels = 2;
 st->codecpar->sample_rate = s1->sample_rate;
+st->start_time = 0;
+return st;
+}
+
+static int aptx_read_header(AVFormatContext *s)
+{
+AVStream *st = aptx_read_header_common(s);
+if (!st)
+return AVERROR(ENOMEM);
+st->codecpar->codec_id = 

Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-09 Thread Michael Niedermayer
On Sun, Jan 07, 2018 at 04:55:43PM +0100, Aurelien Jacobs wrote:
> On Sun, Jan 07, 2018 at 12:53:27AM +0100, Michael Niedermayer wrote:
> > On Sat, Jan 06, 2018 at 05:48:08PM +0100, Aurelien Jacobs wrote:
> > > ---
> > >  Changelog|  2 +-
> > >  libavformat/Makefile |  2 ++
> > >  libavformat/allformats.c |  1 +
> > >  libavformat/aptxdec.c| 51 
> > > 
> > >  libavformat/rawenc.c | 13 
> > >  5 files changed, 64 insertions(+), 5 deletions(-)
> > [...]
> > > @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = {
> > >  .version= LIBAVUTIL_VERSION_INT,
> > >  };
> > >  
> > > +#if CONFIG_APTX_MUXER
> > >  AVInputFormat ff_aptx_demuxer = {
> > >  .name   = "aptx",
> > >  .long_name  = NULL_IF_CONFIG_SMALL("raw aptX"),
> > > @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = {
> > >  .flags  = AVFMT_GENERIC_INDEX,
> > 
> > >  .priv_class = _demuxer_class,
> > [...]
> > > +.priv_class = _demuxer_class,
> > 
> > this cause the code (for example fate) to infinite loop
> 
> Oh, indeed, it seems 2 demuxers can't share the same priv_class.
> Here is an updated patch.

yes, works here, no more comments from me

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-07 Thread Aurelien Jacobs
On Sun, Jan 07, 2018 at 12:53:27AM +0100, Michael Niedermayer wrote:
> On Sat, Jan 06, 2018 at 05:48:08PM +0100, Aurelien Jacobs wrote:
> > ---
> >  Changelog|  2 +-
> >  libavformat/Makefile |  2 ++
> >  libavformat/allformats.c |  1 +
> >  libavformat/aptxdec.c| 51 
> > 
> >  libavformat/rawenc.c | 13 
> >  5 files changed, 64 insertions(+), 5 deletions(-)
> [...]
> > @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = {
> >  .version= LIBAVUTIL_VERSION_INT,
> >  };
> >  
> > +#if CONFIG_APTX_MUXER
> >  AVInputFormat ff_aptx_demuxer = {
> >  .name   = "aptx",
> >  .long_name  = NULL_IF_CONFIG_SMALL("raw aptX"),
> > @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = {
> >  .flags  = AVFMT_GENERIC_INDEX,
> 
> >  .priv_class = _demuxer_class,
> [...]
> > +.priv_class = _demuxer_class,
> 
> this cause the code (for example fate) to infinite loop

Oh, indeed, it seems 2 demuxers can't share the same priv_class.
Here is an updated patch.
>From 319e203fc6ec9ae7b17d28ac63b658a63c933176 Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs 
Date: Sat, 6 Jan 2018 17:33:01 +0100
Subject: [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

---
 Changelog|  2 +-
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  1 +
 libavformat/aptxdec.c| 58 
 libavformat/rawenc.c | 13 +++
 5 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index 9349bf1e8d..3a97b0b02e 100644
--- a/Changelog
+++ b/Changelog
@@ -12,7 +12,7 @@ version :
 - Intel QSV-accelerated MJPEG encoding
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX and aptX HD encoder and decoder
-- Raw aptX muxer and demuxer
+- Raw aptX and aptX HD muxer and demuxer
 - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cb70eac920..dbe2890297 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -96,6 +96,8 @@ OBJS-$(CONFIG_APNG_DEMUXER)  += apngdec.o
 OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_APTX_DEMUXER)  += aptxdec.o rawdec.o
 OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o
+OBJS-$(CONFIG_APTX_HD_DEMUXER)   += aptxdec.o rawdec.o
+OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec_f.o asf.o asfcrypt.o \
 avlanguage.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a9b9883c9..b70b7463b9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -70,6 +70,7 @@ static void register_all(void)
 REGISTER_DEMUXER (APE,  ape);
 REGISTER_MUXDEMUX(APNG, apng);
 REGISTER_MUXDEMUX(APTX, aptx);
+REGISTER_MUXDEMUX(APTX_HD,  aptx_hd);
 REGISTER_DEMUXER (AQTITLE,  aqtitle);
 REGISTER_MUXDEMUX(ASF,  asf);
 REGISTER_DEMUXER (ASF_O,asf_o);
diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c
index 3b8fae1b55..467bc3fd5a 100644
--- a/libavformat/aptxdec.c
+++ b/libavformat/aptxdec.c
@@ -26,26 +26,49 @@
 #define APTX_BLOCK_SIZE   4
 #define APTX_PACKET_SIZE  (256*APTX_BLOCK_SIZE)
 
+#define APTX_HD_BLOCK_SIZE   6
+#define APTX_HD_PACKET_SIZE  (256*APTX_HD_BLOCK_SIZE)
+
 typedef struct AptXDemuxerContext {
 AVClass *class;
 int sample_rate;
 } AptXDemuxerContext;
 
-static int aptx_read_header(AVFormatContext *s)
+static AVStream *aptx_read_header_common(AVFormatContext *s)
 {
 AptXDemuxerContext *s1 = s->priv_data;
 AVStream *st = avformat_new_stream(s, NULL);
 if (!st)
-return AVERROR(ENOMEM);
+return NULL;
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-st->codecpar->codec_id = AV_CODEC_ID_APTX;
 st->codecpar->format = AV_SAMPLE_FMT_S32P;
 st->codecpar->channels = 2;
 st->codecpar->sample_rate = s1->sample_rate;
+st->start_time = 0;
+return st;
+}
+
+static int aptx_read_header(AVFormatContext *s)
+{
+AVStream *st = aptx_read_header_common(s);
+if (!st)
+return AVERROR(ENOMEM);
+st->codecpar->codec_id = AV_CODEC_ID_APTX;
 st->codecpar->bits_per_coded_sample = 4;
 st->codecpar->block_align = APTX_BLOCK_SIZE;
 st->codecpar->frame_size = APTX_PACKET_SIZE;
-st->start_time = 0;
+return 0;
+}
+
+static int aptx_hd_read_header(AVFormatContext *s)
+{
+AVStream *st = aptx_read_header_common(s);
+if (!st)
+return AVERROR(ENOMEM);
+st->codecpar->codec_id = AV_CODEC_ID_APTX_HD;
+st->codecpar->bits_per_coded_sample = 6;
+

Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-06 Thread Michael Niedermayer
On Sat, Jan 06, 2018 at 05:48:08PM +0100, Aurelien Jacobs wrote:
> ---
>  Changelog|  2 +-
>  libavformat/Makefile |  2 ++
>  libavformat/allformats.c |  1 +
>  libavformat/aptxdec.c| 51 
> 
>  libavformat/rawenc.c | 13 
>  5 files changed, 64 insertions(+), 5 deletions(-)
[...]
> @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = {
>  .version= LIBAVUTIL_VERSION_INT,
>  };
>  
> +#if CONFIG_APTX_MUXER
>  AVInputFormat ff_aptx_demuxer = {
>  .name   = "aptx",
>  .long_name  = NULL_IF_CONFIG_SMALL("raw aptX"),
> @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = {
>  .flags  = AVFMT_GENERIC_INDEX,

>  .priv_class = _demuxer_class,
[...]
> +.priv_class = _demuxer_class,

this cause the code (for example fate) to infinite loop

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD

2018-01-06 Thread Aurelien Jacobs
---
 Changelog|  2 +-
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  1 +
 libavformat/aptxdec.c| 51 
 libavformat/rawenc.c | 13 
 5 files changed, 64 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index 9349bf1e8d..3a97b0b02e 100644
--- a/Changelog
+++ b/Changelog
@@ -12,7 +12,7 @@ version :
 - Intel QSV-accelerated MJPEG encoding
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX and aptX HD encoder and decoder
-- Raw aptX muxer and demuxer
+- Raw aptX and aptX HD muxer and demuxer
 - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cb70eac920..dbe2890297 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -96,6 +96,8 @@ OBJS-$(CONFIG_APNG_DEMUXER)  += apngdec.o
 OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_APTX_DEMUXER)  += aptxdec.o rawdec.o
 OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o
+OBJS-$(CONFIG_APTX_HD_DEMUXER)   += aptxdec.o rawdec.o
+OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec_f.o asf.o asfcrypt.o \
 avlanguage.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a9b9883c9..b70b7463b9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -70,6 +70,7 @@ static void register_all(void)
 REGISTER_DEMUXER (APE,  ape);
 REGISTER_MUXDEMUX(APNG, apng);
 REGISTER_MUXDEMUX(APTX, aptx);
+REGISTER_MUXDEMUX(APTX_HD,  aptx_hd);
 REGISTER_DEMUXER (AQTITLE,  aqtitle);
 REGISTER_MUXDEMUX(ASF,  asf);
 REGISTER_DEMUXER (ASF_O,asf_o);
diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c
index 3b8fae1b55..18c2d76b71 100644
--- a/libavformat/aptxdec.c
+++ b/libavformat/aptxdec.c
@@ -26,26 +26,49 @@
 #define APTX_BLOCK_SIZE   4
 #define APTX_PACKET_SIZE  (256*APTX_BLOCK_SIZE)
 
+#define APTX_HD_BLOCK_SIZE   6
+#define APTX_HD_PACKET_SIZE  (256*APTX_HD_BLOCK_SIZE)
+
 typedef struct AptXDemuxerContext {
 AVClass *class;
 int sample_rate;
 } AptXDemuxerContext;
 
-static int aptx_read_header(AVFormatContext *s)
+static AVStream *aptx_read_header_common(AVFormatContext *s)
 {
 AptXDemuxerContext *s1 = s->priv_data;
 AVStream *st = avformat_new_stream(s, NULL);
 if (!st)
-return AVERROR(ENOMEM);
+return NULL;
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-st->codecpar->codec_id = AV_CODEC_ID_APTX;
 st->codecpar->format = AV_SAMPLE_FMT_S32P;
 st->codecpar->channels = 2;
 st->codecpar->sample_rate = s1->sample_rate;
+st->start_time = 0;
+return st;
+}
+
+static int aptx_read_header(AVFormatContext *s)
+{
+AVStream *st = aptx_read_header_common(s);
+if (!st)
+return AVERROR(ENOMEM);
+st->codecpar->codec_id = AV_CODEC_ID_APTX;
 st->codecpar->bits_per_coded_sample = 4;
 st->codecpar->block_align = APTX_BLOCK_SIZE;
 st->codecpar->frame_size = APTX_PACKET_SIZE;
-st->start_time = 0;
+return 0;
+}
+
+static int aptx_hd_read_header(AVFormatContext *s)
+{
+AVStream *st = aptx_read_header_common(s);
+if (!st)
+return AVERROR(ENOMEM);
+st->codecpar->codec_id = AV_CODEC_ID_APTX_HD;
+st->codecpar->bits_per_coded_sample = 6;
+st->codecpar->block_align = APTX_HD_BLOCK_SIZE;
+st->codecpar->frame_size = APTX_HD_PACKET_SIZE;
 return 0;
 }
 
@@ -54,6 +77,11 @@ static int aptx_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE);
 }
 
+static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE);
+}
+
 static const AVOption aptx_options[] = {
 { "sample_rate", "", offsetof(AptXDemuxerContext, sample_rate), 
AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 { NULL },
@@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
+#if CONFIG_APTX_MUXER
 AVInputFormat ff_aptx_demuxer = {
 .name   = "aptx",
 .long_name  = NULL_IF_CONFIG_SMALL("raw aptX"),
@@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = {
 .flags  = AVFMT_GENERIC_INDEX,
 .priv_class = _demuxer_class,
 };
+#endif
+
+#if CONFIG_APTX_HD_DEMUXER
+AVInputFormat ff_aptx_hd_demuxer = {
+.name   = "aptx_hd",
+.long_name  = NULL_IF_CONFIG_SMALL("raw aptX HD"),
+.extensions = "aptxhd",
+.priv_data_size = sizeof(AptXDemuxerContext),
+.read_header= aptx_hd_read_header,
+.read_packet