Re: [FFmpeg-devel] [PATCH] Fixing HW accelerated decoders hanging or throwing error in h263dec

2019-08-07 Thread Stefan Schoenefeld
Hi Phil,

Unfortunately I cannot share the sample we use internally, but it should be 
reproducible with any h.263/mpeg-4 encoded file & hw accelerated decoding.

Thanks
Stefan

-Original Message-
From: ffmpeg-devel  On Behalf Of Philip 
Langdale
Sent: Saturday, August 3, 2019 08:57
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] Fixing HW accelerated decoders hanging or 
throwing error in h263dec

On 2019-08-03 00:09, Timo Rothenpieler wrote:
> On 02.08.2019 11:18, Stefan Schoenefeld wrote:
>> Hi all,
>> 
>> Recently we encountered an issue when decoding a h.263 file:
>> 
>> FFmpeg will freeze when decoding h.263 video with NVDEC. Turns out 
>> this is not directly related to NVDEC but is a problem that shows 
>> with several other HW decoders like VDPAU, though the exact kind of 
>> error is different (either error messages or freezing[1]). The root 
>> cause is that ff_thread_finish_setup() is called twice per frame from 
>> ff_h263_decode_frame(). This is not supported by
>> ff_thread_finish_setup() and specifically checked for and warned 
>> against in the functions code. The issue is also specific to hw 
>> accelerated decoding only as the second call to
>> ff_thread_finish_setup() is only issued when hw acceleration is on. 
>> The fix is simple: add a check that the first call is only send when 
>> hw acceleration is off, and the second call only when hw acceleration 
>> is on (see attached patch). This works fine as far as I was able to 
>> test with vdpau and nvdec/nvcuvid hw decoding. The patch also adds 
>> NVDEC to the hw config list if available.
>> 
>> I also noticed a secondary issue when browsing through the code which 
>> is that, according to documentation, ff_thread_finish_setup() should 
>> only be called if the codec implements update_thread_context(), which 
>> h263dec does not. The patch does not address this and I'm not sure 
>> any action needs to be taken here at all.
>> 
>> Thanks,
>> Stefan
>> 
>> [1] This is depending on whether or not the hw decoder sets the 
>> HWACCEL_CAPS_ASYNC_SAFE flag
>> 
>>  From 0620ee777a8ba98145bb4781e30a77687c97dbf8 Mon Sep 17 00:00:00
>> 2001
>> From: Stefan Schoenefeld 
>> Date: Fri, 2 Aug 2019 10:52:22 +0200
>> Subject: [PATCH] Fixing HW accelerated decoders hanging or throwing 
>> error messages in h263dec
>> 
>> ---
>> libavcodec/h263dec.c | 5 -
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 
>> 6f001f6..8ee844e 100644
>> --- a/libavcodec/h263dec.c
>> +++ b/libavcodec/h263dec.c
>> @@ -614,7 +614,7 @@ retry:
>>   if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
>>   return ret;
>> -if (!s->divx_packed)
>> +if (!s->divx_packed && !avctx->hwaccel)
>>   ff_thread_finish_setup(avctx);
> 
> This seems correct to me, but I'd like another pair of eyes to look 
> over it.

Seems fine to me as well.

> 
>>   if (avctx->hwaccel) {
>> @@ -747,6 +747,9 @@ const AVCodecHWConfigInternal 
>> *ff_h263_hw_config_list[] = { #if CONFIG_H263_VAAPI_HWACCEL
>>   HWACCEL_VAAPI(h263),
>> #endif
>> +#if CONFIG_MPEG4_NVDEC_HWACCEL
>> +HWACCEL_NVDEC(mpeg4),
>> +#endif
> 
> Probably cleaner to split this into its own patch, but otherwise OK.
> 
>> #if CONFIG_MPEG4_VDPAU_HWACCEL
>>   HWACCEL_VDPAU(mpeg4),
>> #endif

Thanks for fixing this. I was always confused about whether h.263 was really 
supported by the hardware or not. Can you provide a link to a reference sample 
that fails without this change and succeeds with it?

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with 
subject "unsubscribe".

NVIDIA GmbH, Wuerselen, Germany, Amtsgericht Aachen, HRB 8361
Managing Director: Karen Theresa Burns

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Fixing HW accelerated decoders hanging or throwing error in h263dec

2019-08-02 Thread Stefan Schoenefeld
Hi all,

Recently we encountered an issue when decoding a h.263 file:

FFmpeg will freeze when decoding h.263 video with NVDEC. Turns out this is not 
directly related to NVDEC but is a problem that shows with several other HW 
decoders like VDPAU, though the exact kind of error is different (either error 
messages or freezing[1]). The root cause is that ff_thread_finish_setup() is 
called twice per frame from ff_h263_decode_frame(). This is not supported by 
ff_thread_finish_setup() and specifically checked for and warned against in the 
functions code. The issue is also specific to hw accelerated decoding only as 
the second call to ff_thread_finish_setup() is only issued when hw acceleration 
is on. The fix is simple: add a check that the first call is only send when hw 
acceleration is off, and the second call only when hw acceleration is on (see 
attached patch). This works fine as far as I was able to test with vdpau and 
nvdec/nvcuvid hw decoding. The patch also adds NVDEC to the hw config list if 
available.

I also noticed a secondary issue when browsing through the code which is that, 
according to documentation, ff_thread_finish_setup() should only be called if 
the codec implements update_thread_context(), which h263dec does not. The patch 
does not address this and I'm not sure any action needs to be taken here at all.

Thanks,
Stefan

[1] This is depending on whether or not the hw decoder sets the  
HWACCEL_CAPS_ASYNC_SAFE flag

>From 0620ee777a8ba98145bb4781e30a77687c97dbf8 Mon Sep 17 00:00:00 2001
From: Stefan Schoenefeld 
Date: Fri, 2 Aug 2019 10:52:22 +0200
Subject: [PATCH] Fixing HW accelerated decoders hanging or throwing error
messages in h263dec

---
libavcodec/h263dec.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 6f001f6..8ee844e 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -614,7 +614,7 @@ retry:
 if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
 return ret;
-if (!s->divx_packed)
+if (!s->divx_packed && !avctx->hwaccel)
 ff_thread_finish_setup(avctx);
 if (avctx->hwaccel) {
@@ -747,6 +747,9 @@ const AVCodecHWConfigInternal *ff_h263_hw_config_list[] = {
#if CONFIG_H263_VAAPI_HWACCEL
 HWACCEL_VAAPI(h263),
#endif
+#if CONFIG_MPEG4_NVDEC_HWACCEL
+HWACCEL_NVDEC(mpeg4),
+#endif
#if CONFIG_MPEG4_VDPAU_HWACCEL
 HWACCEL_VDPAU(mpeg4),
#endif
--
2.7.4


NVIDIA GmbH, Wuerselen, Germany, Amtsgericht Aachen, HRB 8361
Managing Director: Karen Theresa Burns

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


0001-Fixing-HW-accelerated-decoders-hanging-or-throwing-e.patch
Description: 0001-Fixing-HW-accelerated-decoders-hanging-or-throwing-e.patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] dashdec: Fix reading values from SegmentTimeline inside, Period

2019-06-28 Thread Stefan _
Hi,

attached patch fixes a small oversight in dashdec.

YouTube uses DASH manifests structured like this for live recordings, 
seeking is currently broken in those cases.

From b0eceb6bbe0c931d8c67a22980816bf3f8dd0bbe Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Sat, 29 Jun 2019 00:51:28 +0200
Subject: [PATCH] dashdec: Fix reading values from SegmentTimeline inside
 Period

This was missed in commit e752da546463e693865d92a837fc0e8d2b28db2e.
---
 libavformat/dashdec.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 5727d13a51..f0f9aa1d59 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -842,7 +842,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr representation_segmenttemplate_node = NULL;
 xmlNodePtr representation_baseurl_node = NULL;
 xmlNodePtr representation_segmentlist_node = NULL;
-xmlNodePtr segmentlists_tab[2];
+xmlNodePtr segmentlists_tab[3];
 xmlNodePtr fragment_timeline_node = NULL;
 xmlNodePtr fragment_templates_tab[5];
 char *duration_val = NULL;
@@ -1003,9 +1003,10 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr fragmenturl_node = NULL;
 segmentlists_tab[0] = representation_segmentlist_node;
 segmentlists_tab[1] = adaptionset_segmentlist_node;
+segmentlists_tab[2] = period_segmentlist_node;
 
-duration_val = get_val_from_nodes_tab(segmentlists_tab, 2, "duration");
-timescale_val = get_val_from_nodes_tab(segmentlists_tab, 2, "timescale");
+duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, "duration");
+timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, "timescale");
 if (duration_val) {
 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
 av_log(s, AV_LOG_TRACE, "rep->fragment_duration = [%"PRId64"]\n", rep->fragment_duration);
-- 
2.22.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] Patch: to add missing padding to nearest WORD boundary AVI

2018-07-17 Thread stefan . becker555


0001-add-missing-padding-to-nearest-WORD-boundary-AVI.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/mediacodec_wrapper: fix false positives in swdec blacklist

2018-03-06 Thread Stefan _
Hi,

attached patch fixes an issue with the previous mediacodec patch.

From b6a8721679483900b4f824504fdb1f7944ec268f Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 6 Mar 2018 23:14:09 +0100
Subject: [PATCH] avcodec/mediacodec_wrapper: fix false positives in swdec
 blacklist

'OMX.SEC.avc.dec' is a valid hardware decoder, while the decoders
we seek to blacklist all match 'OMX.SEC.*.sw.dec'.
---
 libavcodec/mediacodec_wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 8381128..11d7f66 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -473,7 +473,7 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
 if (
 strstr(name, "OMX.google") ||
 strstr(name, "OMX.ffmpeg") ||
-strstr(name, "OMX.SEC") ||
+(strstr(name, "OMX.SEC") && strstr(name, ".sw.")) ||
 !strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
 av_freep();
 goto done_with_type;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/mediacodec_wrapper: blacklist more software decoders

2018-03-06 Thread Stefan _
Hi,

for hwdec on Android the wrapper attempts to blacklist known software decoders 
also provided through the mediacodec API. The list isn't complete however and 
ffmpeg might e.g. prefer slower "external" HEVC software decoding over its own 
software decoder.

This patch completes the list of known software decoders, which are:

OMX.ffmpeg.*

 see 
https://github.com/AOSB/android_device_lge_hammerhead/blob/master/media_codecs.xml#L89

OMX.SEC.*

 see 
https://chromium.googlesource.com/chromium/src/+/refs/heads/lkgr/media/base/android/media_codec_util.cc#288

OMX.qcom.video.decoder.hevcswvdec

 see 
https://github.com/moonlight-stream/moonlight-android/blob/master/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java#L83
From fbc876a8763db254d4e26d00c8b4fcf9ea7e7183 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 6 Mar 2018 18:47:35 +0100
Subject: [PATCH] avcodec/mediacodec_wrapper: blacklist more software decoders

Additionally blacklist ffmpeg, Samsung and Qualcomm
software implementations offered through MediaCodec.
---
 libavcodec/mediacodec_wrapper.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index dbc37bf463..b12528500d 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -465,7 +465,12 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
 goto done;
 }
 
-if (strstr(name, "OMX.google")) {
+/* Skip software decoders */
+if (
+strstr(name, "OMX.google") ||
+strstr(name, "OMX.ffmpeg") ||
+strstr(name, "OMX.SEC") ||
+!strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
 av_freep();
 goto done_with_type;
 }
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] libavformat/tls: pass numeric hostnames to tls_connect_cbs()

2018-03-01 Thread Stefan _
bump, this is a minor patch
> Hadn't seen that one, it does indeed describe this exact problem.
> I've included it in the commit message, new patch attached.
>
> On 20.02.2018 at 22:30 Carl Eugen Hoyos wrote:
>> 2018-02-20 19:40 GMT+01:00 Stefan _ <sf...@live.de>:
>>
>>> attached patch fixes a small issue with the libtls backend.
>> Please mention ticket #7029 if it is related.
>>
>> Carl Eugen
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] libavformat/tls: pass numeric hostnames to tls_connect_cbs()

2018-02-21 Thread Stefan _
Hadn't seen that one, it does indeed describe this exact problem.
I've included it in the commit message, new patch attached.

On 20.02.2018 at 22:30 Carl Eugen Hoyos wrote:
> 2018-02-20 19:40 GMT+01:00 Stefan _ <sf...@live.de>:
>
>> attached patch fixes a small issue with the libtls backend.
> Please mention ticket #7029 if it is related.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


From 1f8eccb9450847271dae2543e4d8bbb32fc89161 Mon Sep 17 00:00:00 2001
From: sfan5 <sf...@live.de>
Date: Tue, 20 Feb 2018 19:18:13 +0100
Subject: [PATCH] libavformat/tls: pass numeric hostnames to tls_connect_cbs()

Numeric hosts in certificates are not very common, but supported by LibreSSL.
Forward the IP address to make verification work in this case.
Fixes ticket #7029.
---
 libavformat/tls_libtls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
index 1321f7922..ba83b56ff 100644
--- a/libavformat/tls_libtls.c
+++ b/libavformat/tls_libtls.c
@@ -119,7 +119,7 @@ static int ff_tls_open(URLContext *h, const char *uri, int flags, AVDictionary *
 
 if (!c->listen) {
 ret = tls_connect_cbs(p->ctx, tls_read_callback, tls_write_callback,
-c->tcp, !c->numerichost ? c->host : NULL);
+c->tcp, c->host);
 } else {
 struct tls *ctx_new;
 ret = tls_accept_cbs(p->ctx, _new, tls_read_callback,
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/tls: pass numeric hostnames to tls_connect_cbs()

2018-02-20 Thread Stefan _
Hi,

attached patch fixes a small issue with the libtls backend.

reported here: https://github.com/shinchiro/mpv-winbuild-cmake/issues/61

From 4bba90874839cf98ac27756c4a3137be4c84c669 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 20 Feb 2018 19:18:13 +0100
Subject: [PATCH] libavformat/tls: pass numeric hostnames to tls_connect_cbs()

Numeric hosts in certificates are not very common, but supported by LibreSSL.
Forward the IP address to make verification work in this case.
---
 libavformat/tls_libtls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
index 1321f7922..ba83b56ff 100644
--- a/libavformat/tls_libtls.c
+++ b/libavformat/tls_libtls.c
@@ -119,7 +119,7 @@ static int ff_tls_open(URLContext *h, const char *uri, int flags, AVDictionary *
 
 if (!c->listen) {
 ret = tls_connect_cbs(p->ctx, tls_read_callback, tls_write_callback,
-c->tcp, !c->numerichost ? c->host : NULL);
+c->tcp, c->host);
 } else {
 struct tls *ctx_new;
 ret = tls_accept_cbs(p->ctx, _new, tls_read_callback,
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3] lavf/mpegts: add supplementary audio descriptor

2018-02-20 Thread Stefan Pöschel
The supplementary audio descriptor is defined in ETSI EN 300 468 and
provides more details regarding accessibility audio tracks, especially
the normative annex J contains a detailed description of its use.

Its language code (if present) overrides the language code of an also
present ISO 639 language descriptor.

Note that this also changes the priority of multiple descriptors with
language from "the last descriptor with language within the ES loop" to
"specific descriptor over general ISO 639 descriptor".
---
 libavformat/mpegts.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 0a3ad05..bca7a7a 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1840,7 +1840,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 }
 if (i && language[0]) {
 language[i - 1] = 0;
-av_dict_set(>metadata, "language", language, 0);
+/* don't overwrite language, as it may already have been set by
+ * another, more specific descriptor (e.g. supplementary audio) */
+av_dict_set(>metadata, "language", language, 
AV_DICT_DONT_OVERWRITE);
 }
 break;
 case 0x05: /* registration descriptor */
@@ -1895,6 +1897,39 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 st->internal->need_context_update = 1;
 }
 }
+if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */
+int flags;
+
+if (desc_len < 1)
+return AVERROR_INVALIDDATA;
+flags = get8(pp, desc_end);
+
+switch ((flags >> 2) & 0x1F) { /* editorial_classification */
+case 0x01:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+case 0x02:
+st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+break;
+case 0x03:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+}
+
+if (flags & 0x01) { /* language_code_present */
+if (desc_len < 4)
+return AVERROR_INVALIDDATA;
+language[0] = get8(pp, desc_end);
+language[1] = get8(pp, desc_end);
+language[2] = get8(pp, desc_end);
+language[3] = 0;
+
+/* This language always has to override a possible
+ * ISO 639 language descriptor language */
+if (language[0])
+av_dict_set(>metadata, "language", language, 0);
+}
+}
 break;
 default:
 break;
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] lavf/mpegts: add supplementary audio descriptor

2018-02-20 Thread Stefan Pöschel
Am 20.02.2018 um 00:13 schrieb Marton Balint:

>>> +    if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */
>>> +    char flags;
> 
> Change this to int, I see no reason why this is a char.

OK, I will fix that with v3.

>> LGTM. Will commit in a couple days along with my AV_DISPOSITION_DEPENDENT
>> if no one objects.
> 
> LGTM too otherwise.

Great, thanks!

Regards,
Stefan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2] lavf/mpegts: add supplementary audio descriptor

2018-02-16 Thread Stefan Pöschel
The supplementary audio descriptor is defined in ETSI EN 300 468 and
provides more details regarding accessibility audio tracks, especially
the normative annex J contains a detailed description of its use.

Its language code (if present) overrides the language code of an also
present ISO 639 language descriptor.

Note that this also changes the priority of multiple descriptors with
language from "the last descriptor with language within the ES loop" to
"specific descriptor over general ISO 639 descriptor".
---
 libavformat/mpegts.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 0a3ad05..c3b522b 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1840,7 +1840,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 }
 if (i && language[0]) {
 language[i - 1] = 0;
-av_dict_set(>metadata, "language", language, 0);
+/* don't overwrite language, as it may already have been set by
+ * another, more specific descriptor (e.g. supplementary audio) */
+av_dict_set(>metadata, "language", language, 
AV_DICT_DONT_OVERWRITE);
 }
 break;
 case 0x05: /* registration descriptor */
@@ -1895,6 +1897,39 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 st->internal->need_context_update = 1;
 }
 }
+if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */
+char flags;
+
+if (desc_len < 1)
+return AVERROR_INVALIDDATA;
+flags = get8(pp, desc_end);
+
+switch ((flags >> 2) & 0x1F) { /* editorial_classification */
+case 0x01:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+case 0x02:
+st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+break;
+case 0x03:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+}
+
+if (flags & 0x01) { /* language_code_present */
+if (desc_len < 4)
+return AVERROR_INVALIDDATA;
+language[0] = get8(pp, desc_end);
+language[1] = get8(pp, desc_end);
+language[2] = get8(pp, desc_end);
+language[3] = 0;
+
+/* This language always has to override a possible
+ * ISO 639 language descriptor language */
+if (language[0])
+av_dict_set(>metadata, "language", language, 0);
+}
+}
 break;
 default:
 break;
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mpegts: add supplementary audio descriptor

2018-02-16 Thread Stefan Pöschel
Am 16.02.2018 um 20:01 schrieb Aman Gupta:
>> +if(flags & 0x01) {
> 
> Please add a space after "if" here.
> 
>> +if(language[0])
> 
> Same, missing space.

OK, I will add the spaces. And also add the respective field names as
comments, as you did for the mix_type.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mpegts: add supplementary audio descriptor

2018-02-16 Thread Stefan Pöschel
Am 16.02.2018 um 05:10 schrieb Aman Gupta:
> One option would be to re-use an existing flag.
> 
> AV_DISPOSITION_CLEAN_EFFECTS seems to have a similar meaning, but is
> already used for a different purpose in mpegts.c

Right, so this would not be a distinct indicator.

> Another option is AV_DISPOSITION_DESCRIPTIONS which has a similar meaning
> as well.

Mhh...I think this would rather mean to re-use this flag for a different
meaning of a different track type. IMO this would rather lead to confusion.

> Or, maybe it's best to create a new AV_DISPOSITION_* for this purpose.

Yes, this seems to be the best option. It should be as generic as
possible for any possible re-use in other use cases. What about
AV_DISPOSITION_DEPENDENT?

> I'm happy to write a patch for this if we can decide on whether using
> AV_DISPOSITION_DESCRIPTIONS
> makes sense, or come up with
> a good name for a new flag.
Great!

Regards,
Stefan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mpegts: add supplementary audio descriptor

2018-02-15 Thread Stefan Pöschel
Am 15.02.2018 um 20:52 schrieb Aman Gupta:
> Patch looks reasonable to me.

Great!

> It might also be worth surfacing when the audio descriptor flags contain
> mix_type=0, as this indicates a dependent stream which cannot be played
> standalone.

Yes, this seems to be useful, as both mixing types are in real-world use
by broadcasters. Though to be precise, also with mix_type 0, the stream
can be played standalone. It just will contain only the audio
description itself, not mixed with the original soundtrack.

I would however welcome if adding the flag could be done by someone
else, as I don't have deep knowledge in FFmpeg's internals and any
implications of adding a new field (which seems to be necessary here).

Regards,
    Stefan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/mpegts: add supplementary audio descriptor

2018-02-15 Thread Stefan Pöschel
The supplementary audio descriptor is defined in ETSI EN 300 468 and
provides more details regarding accessibility audio tracks, especially
the normative annex J contains a detailed description of its use.

Its language code (if present) overrides the language code of an also
present ISO 639 language descriptor.

Note that this also changes the priority of multiple descriptors with
language from "the last descriptor with language within the ES loop" to
"specific descriptor over general ISO 639 descriptor".
---
 libavformat/mpegts.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 0a3ad05..e5d0e1e 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1840,7 +1840,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 }
 if (i && language[0]) {
 language[i - 1] = 0;
-av_dict_set(>metadata, "language", language, 0);
+/* don't overwrite language, as it may already have been set by
+ * another, more specific descriptor (e.g. supplementary audio) */
+av_dict_set(>metadata, "language", language, 
AV_DICT_DONT_OVERWRITE);
 }
 break;
 case 0x05: /* registration descriptor */
@@ -1895,6 +1897,39 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 st->internal->need_context_update = 1;
 }
 }
+if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */
+char flags;
+
+if (desc_len < 1)
+return AVERROR_INVALIDDATA;
+flags = get8(pp, desc_end);
+
+switch ((flags >> 2) & 0x1F) {
+case 0x01:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+case 0x02:
+st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+break;
+case 0x03:
+st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+break;
+}
+
+if(flags & 0x01) {
+if (desc_len < 4)
+return AVERROR_INVALIDDATA;
+language[0] = get8(pp, desc_end);
+language[1] = get8(pp, desc_end);
+language[2] = get8(pp, desc_end);
+language[3] = 0;
+
+/* This language always has to override a possible
+ * ISO 639 language descriptor language */
+if(language[0])
+av_dict_set(>metadata, "language", language, 0);
+}
+}
 break;
 default:
 break;
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] dashdec: Support SegmentTimeline inside Period

2018-02-06 Thread Stefan _
Hi,

attached patch adds support for yet another small detail of the standard 
that YouTube happens to use for DVR functionality of livestreams.

Ideally dashdec would be fully standards compliant implementation, but 
that doesn't look like it's planned or happening anytime soon.

From 168a7dca7bef54927cf58b61d7140f1d2984693c Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 6 Feb 2018 22:23:41 +0100
Subject: [PATCH] dashdec: Support SegmentTimeline inside Period

---
 libavformat/dashdec.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index f9dc03309..2b396a01b 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -801,6 +801,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr mpd_baseurl_node,
  xmlNodePtr period_baseurl_node,
  xmlNodePtr period_segmenttemplate_node,
+ xmlNodePtr period_segmentlist_node,
  xmlNodePtr fragment_template_node,
  xmlNodePtr content_component_node,
  xmlNodePtr adaptionset_baseurl_node,
@@ -817,7 +818,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr representation_segmentlist_node = NULL;
 xmlNodePtr segmentlists_tab[2];
 xmlNodePtr fragment_timeline_node = NULL;
-xmlNodePtr fragment_templates_tab[4];
+xmlNodePtr fragment_templates_tab[5];
 char *duration_val = NULL;
 char *presentation_timeoffset_val = NULL;
 char *startnumber_val = NULL;
@@ -869,6 +870,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 fragment_templates_tab[1] = adaptionset_segmentlist_node;
 fragment_templates_tab[2] = fragment_template_node;
 fragment_templates_tab[3] = period_segmenttemplate_node;
+fragment_templates_tab[4] = period_segmentlist_node;
 
 presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "presentationTimeOffset");
 duration_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "duration");
@@ -925,6 +927,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline");
 if (!fragment_timeline_node)
 fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline");
+if (!fragment_timeline_node)
+fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline");
 if (fragment_timeline_node) {
 fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node);
 while (fragment_timeline_node) {
@@ -984,6 +988,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline");
 if (!fragment_timeline_node)
 fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline");
+if (!fragment_timeline_node)
+fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline");
 if (fragment_timeline_node) {
 fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node);
 while (fragment_timeline_node) {
@@ -1040,7 +1046,8 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 xmlNodePtr adaptionset_node,
 xmlNodePtr mpd_baseurl_node,
 xmlNodePtr period_baseurl_node,
-xmlNodePtr period_segmenttemplate_node)
+xmlNodePtr period_segmenttemplate_node,
+xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
 xmlNodePtr fragment_template_node = NULL;
@@ -1065,6 +1072,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 mpd_baseurl_node,
 period_baseurl_node,
 period_segmenttemplate_node,
+period_segmentlist_node,
 fragment_template_node,
 content_component_node,
 

Re: [FFmpeg-devel] [PATCH] dashdec: Make use of frame rate specified in Representation

2018-01-20 Thread Stefan _
bump

On 15.01.2018 at 16:58 Stefan _ wrote:
> Hi,
>
> attached patch fixes an annoyance when playing DASH videos from e.g.
> YouTube:
>
> "mov,mp4,m4a,3gp,3g2,mj2: Stream #0: not enough frames to estimate rate;
> consider increasing probesize"


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] dashdec: Make use of frame rate specified in Representation

2018-01-15 Thread Stefan _
Hi,

attached patch fixes an annoyance when playing DASH videos from e.g. 
YouTube:

"mov,mp4,m4a,3gp,3g2,mj2: Stream #0: not enough frames to estimate rate; 
consider increasing probesize"

From e0210059fb420ef2e6c6b0d89c7e733b99f78ee5 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Mon, 15 Jan 2018 16:48:29 +0100
Subject: [PATCH] dashdec: Make use of frame rate specified in Representation

If the manifest provides this, setting r_frame_rate
avoids warnings regarding frame rate estimation.
---
 libavformat/dashdec.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 2492f1d26..a080bf358 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -86,6 +86,7 @@ struct representation {
 enum AVMediaType type;
 char id[20];
 int bandwidth;
+AVRational framerate;
 AVStream *assoc_stream; /* demuxer stream associated with this representation */
 
 int n_fragments;
@@ -674,6 +675,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr representation_node = node;
 char *rep_id_val = xmlGetProp(representation_node, "id");
 char *rep_bandwidth_val = xmlGetProp(representation_node, "bandwidth");
+char *rep_framerate_val = xmlGetProp(representation_node, "frameRate");
 enum AVMediaType type = AVMEDIA_TYPE_UNKNOWN;
 
 // try get information from representation
@@ -843,6 +845,13 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 rep->fragment_timescale = 1;
 rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0;
 strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id));
+rep->framerate = av_make_q(0, 0);
+if (type == AVMEDIA_TYPE_VIDEO && rep_framerate_val) {
+ret = av_parse_video_rate(>framerate, rep_framerate_val);
+if (ret < 0)
+av_log(s, AV_LOG_VERBOSE, "Ignoring invalid frame rate '%s'\n", rep_framerate_val);
+}
+
 if (type == AVMEDIA_TYPE_VIDEO) {
 rep->rep_idx = video_rep_idx;
 dynarray_add(>videos, >n_videos, rep);
@@ -861,6 +870,8 @@ end:
 xmlFree(rep_id_val);
 if (rep_bandwidth_val)
 xmlFree(rep_bandwidth_val);
+if (rep_framerate_val)
+xmlFree(rep_framerate_val);
 
 return ret;
 }
@@ -1571,7 +1582,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation
 AVInputFormat *in_fmt = NULL;
 AVDictionary  *in_fmt_opts = NULL;
 uint8_t *avio_ctx_buffer  = NULL;
-int ret = 0;
+int ret = 0, i;
 
 if (pls->ctx) {
 close_demux_for_component(pls);
@@ -1618,6 +1629,13 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation
 if (ret < 0)
 goto fail;
 if (pls->n_fragments) {
+#if FF_API_R_FRAME_RATE
+if (pls->framerate.den) {
+for (i = 0; i < pls->ctx->nb_streams; i++)
+pls->ctx->streams[i]->r_frame_rate = pls->framerate;
+}
+#endif
+
 ret = avformat_find_stream_info(pls->ctx, NULL);
 if (ret < 0)
 goto fail;
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/6] dashdec: Correct seeking behaviour

2018-01-07 Thread Stefan _

>From bdf3557a400620fce66ca0237f1ff172c227609b Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Fri, 5 Jan 2018 00:51:32 +0100
Subject: [PATCH 4/6] dashdec: Correct seeking behaviour

dash_read_seek() is called only once to issue a seek
of *all* streams to the specified timestamp. But to
avoid reopening each stream, do a "dry run" for streams
that are in a discarded state.
---
 libavformat/dashdec.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index ac0e6c6f9..1252d4156 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1828,19 +1828,22 @@ static int dash_close(AVFormatContext *s)
 return 0;
 }
 
-static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int flags)
+static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int flags, int dry_run)
 {
 int ret = 0;
 int i = 0;
 int j = 0;
 int64_t duration = 0;
 
-av_log(pls->parent, AV_LOG_VERBOSE, "DASH seek pos[%"PRId64"ms], playlist %d\n", seek_pos_msec, pls->rep_idx);
+av_log(pls->parent, AV_LOG_VERBOSE, "DASH seek pos[%"PRId64"ms], playlist %d%s\n",
+seek_pos_msec, pls->rep_idx, dry_run ? " (dry)" : "");
 
 // single fragment mode
 if (pls->n_fragments == 1) {
 pls->cur_timestamp = 0;
 pls->cur_seg_offset = 0;
+if (dry_run)
+return 0;
 ff_read_frame_flush(pls->ctx);
 return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags);
 }
@@ -1885,14 +1888,14 @@ set_seq_num:
 pls->cur_timestamp = 0;
 pls->cur_seg_offset = 0;
 pls->init_sec_buf_read_offset = 0;
-ret = reopen_demux_for_component(s, pls);
+ret = dry_run ? 0 : reopen_demux_for_component(s, pls);
 
 return ret;
 }
 
 static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 {
-int ret, i;
+int ret = 0, i;
 DASHContext *c = s->priv_data;
 int64_t seek_pos_msec = av_rescale_rnd(timestamp, 1000,
s->streams[stream_index]->time_base.den,
@@ -1901,16 +1904,14 @@ static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
 if ((flags & AVSEEK_FLAG_BYTE) || c->is_live)
 return AVERROR(ENOSYS);
 
-ret = AVERROR_EOF;
+/* Seek in discarded streams with dry_run=1 to avoid reopening them */
 for (i = 0; i < c->n_videos; i++) {
-if (c->videos[i]->stream_index == stream_index) {
-ret = dash_seek(s, c->videos[i], seek_pos_msec, flags);
-}
+if (!ret)
+ret = dash_seek(s, c->videos[i], seek_pos_msec, flags, !c->videos[i]->ctx);
 }
 for (i = 0; i < c->n_audios; i++) {
-if (c->audios[i]->stream_index == stream_index) {
-ret = dash_seek(s, c->audios[i], seek_pos_msec, flags);
-}
+if (!ret)
+ret = dash_seek(s, c->audios[i], seek_pos_msec, flags, !c->audios[i]->ctx);
 }
 
 return ret;
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/6] dashdec: Avoid trying to read any segments beyond the last

2018-01-07 Thread Stefan _

>From 277c710159849816bff4e4f5ccd1139348518620 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Fri, 5 Jan 2018 14:19:25 +0100
Subject: [PATCH 5/6] dashdec: Avoid trying to read any segments beyond the
 last

---
 libavformat/dashdec.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1252d4156..af8ab5f2f 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1505,9 +1505,11 @@ restart:
 if (ret > 0)
 goto end;
 
-if (!v->is_restart_needed)
-v->cur_seq_no++;
-v->is_restart_needed = 1;
+if (c->is_live || v->cur_seq_no < v->last_seq_no) {
+	if (!v->is_restart_needed)
+	v->cur_seq_no++;
+	v->is_restart_needed = 1;
+}
 
 end:
 return ret;
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/6] dashdec: Support SegmentTemplate inside Period

2018-01-07 Thread Stefan _

>From 89b42dc60156f1e030a30e13636651db41e9f34b Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Fri, 5 Jan 2018 15:32:23 +0100
Subject: [PATCH 6/6] dashdec: Support SegmentTemplate inside Period

---
 libavformat/dashdec.c | 27 +--
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index af8ab5f2f..ac1080b62 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -646,6 +646,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr adaptionset_node,
  xmlNodePtr mpd_baseurl_node,
  xmlNodePtr period_baseurl_node,
+ xmlNodePtr period_segmenttemplate_node,
  xmlNodePtr fragment_template_node,
  xmlNodePtr content_component_node,
  xmlNodePtr adaptionset_baseurl_node,
@@ -662,7 +663,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr representation_segmentlist_node = NULL;
 xmlNodePtr segmentlists_tab[2];
 xmlNodePtr fragment_timeline_node = NULL;
-xmlNodePtr fragment_templates_tab[3];
+xmlNodePtr fragment_templates_tab[4];
 char *duration_val = NULL;
 char *presentation_timeoffset_val = NULL;
 char *startnumber_val = NULL;
@@ -702,18 +703,19 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 baseurl_nodes[2] = adaptionset_baseurl_node;
 baseurl_nodes[3] = representation_baseurl_node;
 
-if (representation_segmenttemplate_node || fragment_template_node) {
+if (representation_segmenttemplate_node || fragment_template_node || period_segmenttemplate_node) {
 fragment_timeline_node = NULL;
 fragment_templates_tab[0] = representation_segmenttemplate_node;
 fragment_templates_tab[1] = adaptionset_segmentlist_node;
 fragment_templates_tab[2] = fragment_template_node;
+fragment_templates_tab[3] = period_segmenttemplate_node;
 
-presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "presentationTimeOffset");
-duration_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "duration");
-startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "startNumber");
-timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "timescale");
-initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "initialization");
-media_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "media");
+presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "presentationTimeOffset");
+duration_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "duration");
+startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "startNumber");
+timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "timescale");
+initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "initialization");
+media_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "media");
 
 if (initialization_val) {
 rep->init_section = av_mallocz(sizeof(struct fragment));
@@ -866,7 +868,8 @@ end:
 static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 xmlNodePtr adaptionset_node,
 xmlNodePtr mpd_baseurl_node,
-xmlNodePtr period_baseurl_node)
+xmlNodePtr period_baseurl_node,
+xmlNodePtr period_segmenttemplate_node)
 {
 int ret = 0;
 xmlNodePtr fragment_template_node = NULL;
@@ -890,6 +893,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 adaptionset_node,
 mpd_baseurl_node,
 period_baseurl_node,
+period_segmenttemplate_node,
 fragment_template_node,
 content_component_node,
 adaptionset_baseurl_node,
@@ -918,6 +922,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
 xmlNodePtr period_node = NULL;
 xmlNodePtr mpd_baseurl_node = NULL;
 xmlNodePtr period_baseurl_node = NULL;
+xmlNodePtr period_segmenttemplate_node = NULL;
 xmlNodePtr 

[FFmpeg-devel] [PATCH 1/6] dashdec: Expose bandwidth and representation ID as metadata

2018-01-07 Thread Stefan _
Hi,

I did some work on the DASH demuxer.

The primary goal was making it viable to play YouTube/Vimeo/... videos 
using the native demuxer, since mpv currently uses a workaround in form 
of Edit Decision Lists (EDL).


Implemented features:

* Exposing id / bitrate as stream metadata (similar to the HLS demuxer)

* Support for multiple video and audio streams

* A few minor parts of the specification that are in use at YouTube


>From ba640900c260f8b5b1919c4274b2c2e3e57e2546 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 4 Jan 2018 23:45:26 +0100
Subject: [PATCH 1/6] dashdec: Expose bandwidth and representation ID as
 metadata

---
 libavformat/dashdec.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 0e3afd2a3..1a18ab021 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -84,6 +84,8 @@ struct representation {
 int stream_index;
 
 enum AVMediaType type;
+char id[20];
+int bandwidth;
 
 int n_fragments;
 struct fragment **fragments; /* VOD list of fragment for profile */
@@ -801,6 +803,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 if (rep) {
 if (rep->fragment_duration > 0 && !rep->fragment_timescale)
 rep->fragment_timescale = 1;
+rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0;
+strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id));
 if (type == AVMEDIA_TYPE_VIDEO) {
 rep->rep_idx = video_rep_idx;
 c->cur_video = rep;
@@ -1650,10 +1654,20 @@ static int dash_read_header(AVFormatContext *s)
 }
 
 if (c->cur_video) {
-av_program_add_stream_index(s, 0, c->cur_video->stream_index);
+int stream_index = c->cur_video->stream_index;
+av_program_add_stream_index(s, 0, stream_index);
+if (c->cur_video->bandwidth > 0)
+av_dict_set_int(>streams[stream_index]->metadata, "variant_bitrate", c->cur_video->bandwidth, 0);
+if (c->cur_video->id[0])
+av_dict_set(>streams[stream_index]->metadata, "id", c->cur_video->id, 0);
 }
 if (c->cur_audio) {
-av_program_add_stream_index(s, 0, c->cur_audio->stream_index);
+int stream_index = c->cur_audio->stream_index;
+av_program_add_stream_index(s, 0, stream_index);
+if (c->cur_audio->bandwidth > 0)
+av_dict_set_int(>streams[stream_index]->metadata, "variant_bitrate", c->cur_audio->bandwidth, 0);
+if (c->cur_audio->id[0])
+av_dict_set(>streams[stream_index]->metadata, "id", c->cur_audio->id, 0);
 }
 }
 
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/6] dashdec: Support for multiple video/audio streams

2018-01-07 Thread Stefan _

>From 857da994ba1f3466cd6a3b28d025a95301577ad2 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Fri, 5 Jan 2018 00:03:06 +0100
Subject: [PATCH 2/6] dashdec: Support for multiple video/audio streams

---
 doc/demuxers.texi |  10 ++
 libavformat/dashdec.c | 344 +++---
 2 files changed, 225 insertions(+), 129 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 608016723..e7c2abce5 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -244,6 +244,16 @@ file subdir/file-2.wav
 @end example
 @end itemize
 
+@section dash
+
+Dynamic Adaptive Streaming over HTTP demuxer.
+
+This demuxer presents all AVStreams found in the manifest.
+By setting the discard flags on AVStreams the caller can decide
+which streams to actually receive.
+Each stream mirrors the @code{id} and @code{bandwidth} properties from the
+@code{} as metadata keys named "id" and "variant_bitrate" respectively.
+
 @section flv, live_flv
 
 Adobe Flash Video Format demuxer.
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1a18ab021..676979638 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -86,6 +86,7 @@ struct representation {
 enum AVMediaType type;
 char id[20];
 int bandwidth;
+AVStream *assoc_stream; /* demuxer stream associated with this representation */
 
 int n_fragments;
 struct fragment **fragments; /* VOD list of fragment for profile */
@@ -120,8 +121,11 @@ struct representation {
 typedef struct DASHContext {
 const AVClass *class;
 char *base_url;
-struct representation *cur_video;
-struct representation *cur_audio;
+
+int n_videos;
+struct representation **videos;
+int n_audios;
+struct representation **audios;
 
 /* MediaPresentationDescription Attribute */
 uint64_t media_presentation_duration;
@@ -333,6 +337,28 @@ static void free_representation(struct representation *pls)
 av_freep();
 }
 
+static void free_video_list(DASHContext *c)
+{
+int i;
+for (i = 0; i < c->n_videos; i++) {
+struct representation *pls = c->videos[i];
+free_representation(pls);
+}
+av_freep(>videos);
+c->n_videos = 0;
+}
+
+static void free_audio_list(DASHContext *c)
+{
+int i;
+for (i = 0; i < c->n_audios; i++) {
+struct representation *pls = c->audios[i];
+free_representation(pls);
+}
+av_freep(>audios);
+c->n_audios = 0;
+}
+
 static void set_httpheader_options(DASHContext *c, AVDictionary **opts)
 {
 // broker prior HTTP options that should be consistent across requests
@@ -658,7 +684,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 type = get_content_type(adaptionset_node);
 if (type == AVMEDIA_TYPE_UNKNOWN) {
 av_log(s, AV_LOG_VERBOSE, "Parsing '%s' - skipp not supported representation type\n", url);
-} else if ((type == AVMEDIA_TYPE_VIDEO && !c->cur_video) || (type == AVMEDIA_TYPE_AUDIO && !c->cur_audio)) {
+} else if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) {
 // convert selected representation to our internal struct
 rep = av_mallocz(sizeof(struct representation));
 if (!rep) {
@@ -807,10 +833,10 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id));
 if (type == AVMEDIA_TYPE_VIDEO) {
 rep->rep_idx = video_rep_idx;
-c->cur_video = rep;
+dynarray_add(>videos, >n_videos, rep);
 } else {
 rep->rep_idx = audio_rep_idx;
-c->cur_audio = rep;
+dynarray_add(>audios, >n_audios, rep);
 }
 }
 }
@@ -883,8 +909,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
 char *val  = NULL;
 uint32_t perdiod_duration_sec = 0;
 uint32_t perdiod_start_sec = 0;
-int32_t audio_rep_idx = 0;
-int32_t video_rep_idx = 0;
 
 if (!in) {
 close_in = 1;
@@ -1014,14 +1038,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
 }
 adaptionset_node = xmlNextElementSibling(adaptionset_node);
 }
-if (c->cur_video) {
-c->cur_video->rep_count = video_rep_idx;
-av_log(s, AV_LOG_VERBOSE, "rep_idx[%d]\n", (int)c->cur_video->rep_idx);
-av_log(s, AV_LOG_VERBOSE, "rep_count[%d]\n", (int)video_rep_idx);
-}
-if (c->cur_audio) {
-c->cur_audio->rep_count = audio_rep_idx;
-}
 cleanup:
 /*free the document */
 xmlFreeDoc(doc);
@@ -1139,48 +1155,71 @@ static void move_segments(struct representation *rep_src, struct representation
 static int refresh_manifest(AVFormatContext *s)
 {
 
-int ret = 0;
+int ret = 0, i;
 DASHContext *c = s->priv_data;
 
 // save current 

[FFmpeg-devel] [PATCH 3/6] dashdec: Search for segment timeline inside AdaptionSets too

2018-01-07 Thread Stefan _

>From c06d6cbcdc9092428d3764a969604d1f22725e56 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Fri, 5 Jan 2018 00:19:53 +0100
Subject: [PATCH 3/6] dashdec: Search for segment timeline inside AdaptionSets
 too

---
 libavformat/dashdec.c | 40 +++-
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 676979638..ac0e6c6f9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -648,7 +648,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr period_baseurl_node,
  xmlNodePtr fragment_template_node,
  xmlNodePtr content_component_node,
- xmlNodePtr adaptionset_baseurl_node)
+ xmlNodePtr adaptionset_baseurl_node,
+ xmlNodePtr adaptionset_segmentlist_node)
 {
 int32_t ret = 0;
 int32_t audio_rep_idx = 0;
@@ -659,8 +660,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 xmlNodePtr representation_segmenttemplate_node = NULL;
 xmlNodePtr representation_baseurl_node = NULL;
 xmlNodePtr representation_segmentlist_node = NULL;
+xmlNodePtr segmentlists_tab[2];
 xmlNodePtr fragment_timeline_node = NULL;
-xmlNodePtr fragment_templates_tab[2];
+xmlNodePtr fragment_templates_tab[3];
 char *duration_val = NULL;
 char *presentation_timeoffset_val = NULL;
 char *startnumber_val = NULL;
@@ -703,14 +705,15 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 if (representation_segmenttemplate_node || fragment_template_node) {
 fragment_timeline_node = NULL;
 fragment_templates_tab[0] = representation_segmenttemplate_node;
-fragment_templates_tab[1] = fragment_template_node;
+fragment_templates_tab[1] = adaptionset_segmentlist_node;
+fragment_templates_tab[2] = fragment_template_node;
 
-presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "presentationTimeOffset");
-duration_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "duration");
-startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "startNumber");
-timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "timescale");
-initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "initialization");
-media_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "media");
+presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "presentationTimeOffset");
+duration_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "duration");
+startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "startNumber");
+timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "timescale");
+initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "initialization");
+media_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "media");
 
 if (initialization_val) {
 rep->init_section = av_mallocz(sizeof(struct fragment));
@@ -756,6 +759,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 
 if (!fragment_timeline_node)
 fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline");
+if (!fragment_timeline_node)
+fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline");
 if (fragment_timeline_node) {
 fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node);
 while (fragment_timeline_node) {
@@ -784,8 +789,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 // TODO: https://www.brendanlong.com/the-structure-of-an-mpeg-dash-mpd.html
 // http://www-itec.uni-klu.ac.at/dash/ddash/mpdGenerator.php?fragmentlength=15=full
 xmlNodePtr fragmenturl_node = NULL;
-duration_val = xmlGetProp(representation_segmentlist_node, "duration");
-timescale_val = xmlGetProp(representation_segmentlist_node, "timescale");
+segmentlists_tab[0] = representation_segmentlist_node;
+segmentlists_tab[1] = adaptionset_segmentlist_node;
+
+duration_val = get_val_from_nodes_tab(segmentlists_tab, 2, "duration");
+timescale_val = get_val_from_nodes_tab(segmentlists_tab, 2, "timescale");
 if (duration_val) {
 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
   

Re: [FFmpeg-devel] [PATCH v3 2/2] libavcodec/hevcdec: implement skip_frame

2017-12-19 Thread Stefan _
On 07.12.2017 at 20:56 Stefan _ wrote:
> On 07.12.2017 at 17:41 Michael Niedermayer wrote:
>> The move and the functional change should be in seperate patches
>> that keeps changes easy to read and understand
>>
>> [...]

bump

(Previous patch in same series was merged. This one wasn't and hasn't 
received any comments either.)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: remove libtls fallback check

2017-12-19 Thread Stefan _
On 19.12.2017 at 18:28 James Almer wrote:
> On 12/19/2017 2:13 PM, Stefan _ wrote:
>> Last patch had a minor issue, fixed version attached.
> Applied.
Thanks.
>
> The fallback check for that matter should be removed. It's pointless
> since every supported version of the library ships a .pc file, and it's
> pretty much guaranteed to not work with static builds.

Sounds reasonable, corresponding patch is attached.

From 0224270196ea9329dada21b86848a899c995cc74 Mon Sep 17 00:00:00 2001
From: sfan5 <sf...@live.de>
Date: Tue, 19 Dec 2017 18:45:27 +0100
Subject: [PATCH] configure: remove libtls fallback check

This check is not needed for any supported version of libtls
and causes issues with static builds (libtls links to -lssl -lcrypto).

Signed-off-by: sfan5 <sf...@live.de>
---
 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index c01f414f9a..1b07dc2ce7 100755
--- a/configure
+++ b/configure
@@ -5894,8 +5894,7 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
 enabled libtesseract  && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
-enabled libtls&& { check_pkg_config libtls libtls tls.h tls_configure ||
-   require libtls tls.h tls_configure -ltls; }
+enabled libtls&& require_pkg_config libtls libtls tls.h tls_configure
 enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame &&
  { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] configure: fix pkg-config check for libtls

2017-12-19 Thread Stefan _
Last patch had a minor issue, fixed version attached.
From 6f6bcf77ce2aaf6a84858d34112f61128e779fda Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 19 Dec 2017 17:33:26 +0100
Subject: [PATCH] configure: fix pkg-config check for libtls

This was not accounted for during merge and is required due to
the refactor in commit 93ccba96df6340249b0db227d5bc3297010797a4.

Signed-off-by: sfan5 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2f7db05faa..c01f414f9a 100755
--- a/configure
+++ b/configure
@@ -5894,7 +5894,7 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
 enabled libtesseract  && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
-enabled libtls&& { use_pkg_config libtls libtls tls.h tls_configure ||
+enabled libtls&& { check_pkg_config libtls libtls tls.h tls_configure ||
require libtls tls.h tls_configure -ltls; }
 enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame &&
  { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: fix pkg-config check for libtls

2017-12-19 Thread Stefan _
Hi,

Attached patch fixes an issue with the LibreSSL pkg-config check in 
configure.

Between the creation of my libtls patchset and the date it was pushed, a 
refactor had changed all invocations of use_pkg_config to 
require_pkg_config, resulting in pkg-config never working.

From 0afe7b4257f55ccfd00d65861c33ff693d2d19b3 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 19 Dec 2017 17:33:26 +0100
Subject: [PATCH] configure: fix pkg-config check for libtls

This was not accounted for during merge and is required due to
the refactor in commit 93ccba96df6340249b0db227d5bc3297010797a4.

Signed-off-by: sfan5 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2f7db05faa..99f6147ba7 100755
--- a/configure
+++ b/configure
@@ -5894,7 +5894,7 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
 enabled libtesseract  && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
-enabled libtls&& { use_pkg_config libtls libtls tls.h tls_configure ||
+enabled libtls&& { require_pkg_config libtls libtls tls.h tls_configure ||
require libtls tls.h tls_configure -ltls; }
 enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame &&
  { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: Fix case of static libmp3lame

2017-12-16 Thread Stefan Pöschel
Fixes #6918.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index d5bbb5b..20ca792 100755
--- a/configure
+++ b/configure
@@ -5853,7 +5853,7 @@ enabled libkvazaar&& require_pkg_config 
libkvazaar "kvazaar >= 0.8.1" kv
 enabled libmfx&& { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" 
MFXInit ||
{ require libmfx "mfx/mfxvideo.h" MFXInit 
"-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
 enabled libmodplug&& require_pkg_config libmodplug libmodplug 
libmodplug/modplug.h ModPlug_Load
-enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
lame_set_VBR_quality -lmp3lame
+enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
lame_set_VBR_quality -lmp3lame -lm
 enabled libmysofa && require libmysofa "mysofa.h" mysofa_load -lmysofa 
$zlib_extralibs
 enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion -lnppig 
-lnppicc -lnppc ||
check_lib libnpp npp.h nppGetLibVersion -lnppi 
-lnppc ||
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat: LibreSSL (libtls) support

2017-12-09 Thread Stefan _
On 09.12.2017 at 17:29 Matt Oliver wrote:
> OK I finally got around to looking through this (sorry for the delay I
> previously hadnt had time) and everything looks good.
> Since someone complains about LibreSSL not working with our OpenSSL support
> every couple of months then this would be a welcome fix and in my opinion
> this is the best way to support LibreSSL going forward. If Stefan is happy
> to continue to support this in the future if needed then im on-board with
> merging this.

Thanks for taking a look. Previously, I was under the impression that 
LibreSSL support was not desired (though nobody has voiced their 
concerns on the ML).

In any case, I'm fine with maintaining the libtls backend.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 2/2] libavcodec/hevcdec: implement skip_frame

2017-12-07 Thread Stefan _
On 07.12.2017 at 17:41 Michael Niedermayer wrote:
> The move and the functional change should be in seperate patches
> that keeps changes easy to read and understand
>
> [...]


>From abeb2b106a64d96b216912d4272a734b123b62e2 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 7 Dec 2017 20:40:35 +0100
Subject: [PATCH 2/2] libavcodec/hevcdec: implement skip_frame

---
 libavcodec/hevcdec.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 433a7056ea..4bfae8c12b 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2905,6 +2905,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
 if (ret < 0)
 return ret;
 
+if (
+(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
+(s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
+(s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) {
+break;
+}
+
 if (s->sh.first_slice_in_pic_flag) {
 if (s->max_ra == INT_MAX) {
 if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
@@ -3028,7 +3035,14 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
 
 /* decode the NAL units */
 for (i = 0; i < s->pkt.nb_nals; i++) {
-ret = decode_nal_unit(s, >pkt.nals[i]);
+H2645NAL *nal = >pkt.nals[i];
+
+if (s->avctx->skip_frame >= AVDISCARD_ALL ||
+(s->avctx->skip_frame >= AVDISCARD_NONREF
+&& ff_hevc_nal_is_nonref(nal->type)))
+continue;
+
+ret = decode_nal_unit(s, nal);
 if (ret < 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function

2017-12-07 Thread Stefan _
On 07.12.2017 at 17:41 Michael Niedermayer wrote:
> The move and the functional change should be in seperate patches
> that keeps changes easy to read and understand
>
> [...]


>From b5d6c40c6516b90abeeffb7cf8ecd1ca1c3f7cb2 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 7 Dec 2017 20:37:48 +0100
Subject: [PATCH 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case
 into function

In preparation for implementation of skip_frame.
---
 libavcodec/hevc_filter.c | 20 +++-
 libavcodec/hevcdec.h | 20 
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 94fb7cd3d1..6b9824088c 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,29 +842,15 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 {
 int x_end = x >= s->ps.sps->width  - ctb_size;
-int skip = 0, is_n = 0;
-switch (s->nal_unit_type) {
-case HEVC_NAL_TRAIL_N:
-case HEVC_NAL_TSA_N:
-case HEVC_NAL_STSA_N:
-case HEVC_NAL_RADL_N:
-case HEVC_NAL_RASL_N:
-case HEVC_NAL_VCL_N10:
-case HEVC_NAL_VCL_N12:
-case HEVC_NAL_VCL_N14:
-case HEVC_NAL_BLA_N_LP:
-case HEVC_NAL_IDR_N_LP:
-is_n = 1;
-break;
-default: break;
-}
+int skip = 0;
 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
  s->sh.slice_type != HEVC_SLICE_I) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
  s->sh.slice_type == HEVC_SLICE_B) ||
-(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n))
+(s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
+ff_hevc_nal_is_nonref(s->nal_unit_type)))
 skip = 1;
 
 if (!skip)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index ef918f4fb2..b311edc8ae 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -548,6 +548,26 @@ int ff_hevc_frame_nb_refs(HEVCContext *s);
 
 int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
 
+static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
+{
+switch (type) {
+case HEVC_NAL_TRAIL_N:
+case HEVC_NAL_TSA_N:
+case HEVC_NAL_STSA_N:
+case HEVC_NAL_RADL_N:
+case HEVC_NAL_RASL_N:
+case HEVC_NAL_VCL_N10:
+case HEVC_NAL_VCL_N12:
+case HEVC_NAL_VCL_N14:
+case HEVC_NAL_BLA_N_LP:
+case HEVC_NAL_IDR_N_LP:
+return 1;
+break;
+default: break;
+}
+return 0;
+}
+
 /**
  * Find next frame in output order and put a reference to it in frame.
  * @return 1 if a frame was output, 0 otherwise
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] libavcodec/hevc_filter: implement skip_frame

2017-12-06 Thread Stefan _
On 06.12.2017 at 18:32 Michael Niedermayer wrote:
> This is duplicated, it should be moved into a seperate function
>
> [...]
>
Done.

From 7a9651040c1c4815d82712cb98dbd7bcf8c085bb Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 5 Dec 2017 23:26:14 +0100
Subject: [PATCH] libavcodec/hevc_filter: implement skip_frame

Also move AVDISCARD_NONREF check into inline function.
---
 libavcodec/hevc_filter.c | 20 +++-
 libavcodec/hevcdec.c | 16 +++-
 libavcodec/hevcdec.h | 20 
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 94fb7cd3d1..6b9824088c 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,29 +842,15 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 {
 int x_end = x >= s->ps.sps->width  - ctb_size;
-int skip = 0, is_n = 0;
-switch (s->nal_unit_type) {
-case HEVC_NAL_TRAIL_N:
-case HEVC_NAL_TSA_N:
-case HEVC_NAL_STSA_N:
-case HEVC_NAL_RADL_N:
-case HEVC_NAL_RASL_N:
-case HEVC_NAL_VCL_N10:
-case HEVC_NAL_VCL_N12:
-case HEVC_NAL_VCL_N14:
-case HEVC_NAL_BLA_N_LP:
-case HEVC_NAL_IDR_N_LP:
-is_n = 1;
-break;
-default: break;
-}
+int skip = 0;
 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
  s->sh.slice_type != HEVC_SLICE_I) ||
 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
  s->sh.slice_type == HEVC_SLICE_B) ||
-(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n))
+(s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
+ff_hevc_nal_is_nonref(s->nal_unit_type)))
 skip = 1;
 
 if (!skip)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 433a7056ea..4bfae8c12b 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2905,6 +2905,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
 if (ret < 0)
 return ret;
 
+if (
+(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
+(s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
+(s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) {
+break;
+}
+
 if (s->sh.first_slice_in_pic_flag) {
 if (s->max_ra == INT_MAX) {
 if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
@@ -3028,7 +3035,14 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
 
 /* decode the NAL units */
 for (i = 0; i < s->pkt.nb_nals; i++) {
-ret = decode_nal_unit(s, >pkt.nals[i]);
+H2645NAL *nal = >pkt.nals[i];
+
+if (s->avctx->skip_frame >= AVDISCARD_ALL ||
+(s->avctx->skip_frame >= AVDISCARD_NONREF
+&& ff_hevc_nal_is_nonref(nal->type)))
+continue;
+
+ret = decode_nal_unit(s, nal);
 if (ret < 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index ef918f4fb2..b311edc8ae 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -548,6 +548,26 @@ int ff_hevc_frame_nb_refs(HEVCContext *s);
 
 int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
 
+static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
+{
+switch (type) {
+case HEVC_NAL_TRAIL_N:
+case HEVC_NAL_TSA_N:
+case HEVC_NAL_STSA_N:
+case HEVC_NAL_RADL_N:
+case HEVC_NAL_RASL_N:
+case HEVC_NAL_VCL_N10:
+case HEVC_NAL_VCL_N12:
+case HEVC_NAL_VCL_N14:
+case HEVC_NAL_BLA_N_LP:
+case HEVC_NAL_IDR_N_LP:
+return 1;
+break;
+default: break;
+}
+return 0;
+}
+
 /**
  * Find next frame in output order and put a reference to it in frame.
  * @return 1 if a frame was output, 0 otherwise
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavcodec/hevc_filter: implement skip_frame

2017-12-05 Thread Stefan _
On 04.12.2017 at 21:06 Carl Eugen Hoyos wrote:
> 2017-12-01 0:22 GMT+01:00 Stefan _ <sf...@live.de>:
>
>> Attached patch adds full support for skip_loop_filter
>> (all levels) to the hevc decoder.
> Will you also work on -skip_frame for hevc?
>
> Carl Eugen

I gave it a try. The different levels should all work correctly, since I 
compared the "effects" to a H.264 sample.

'make fate-hevc' passes.

From 8ee08adebd9994c3517c692cc99f0839d3d8f7ca Mon Sep 17 00:00:00 2001
From: sfan5 <sf...@live.de>
Date: Tue, 5 Dec 2017 23:26:14 +0100
Subject: [PATCH] libavcodec/hevc_filter: implement skip_frame

---
 libavcodec/hevcdec.c | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 433a7056ea..37f2ad76eb 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2905,6 +2905,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
 if (ret < 0)
 return ret;
 
+if (
+(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
+(s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
+(s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) {
+break;
+}
+
 if (s->sh.first_slice_in_pic_flag) {
 if (s->max_ra == INT_MAX) {
 if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
@@ -3028,7 +3035,29 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
 
 /* decode the NAL units */
 for (i = 0; i < s->pkt.nb_nals; i++) {
-ret = decode_nal_unit(s, >pkt.nals[i]);
+H2645NAL *nal = >pkt.nals[i];
+int is_n = 0;
+
+switch (nal->type) {
+case HEVC_NAL_TRAIL_N:
+case HEVC_NAL_TSA_N:
+case HEVC_NAL_STSA_N:
+case HEVC_NAL_RADL_N:
+case HEVC_NAL_RASL_N:
+case HEVC_NAL_VCL_N10:
+case HEVC_NAL_VCL_N12:
+case HEVC_NAL_VCL_N14:
+case HEVC_NAL_BLA_N_LP:
+case HEVC_NAL_IDR_N_LP:
+is_n = 1;
+break;
+default: break;
+}
+if ((s->avctx->skip_frame >= AVDISCARD_NONREF && is_n) ||
+s->avctx->skip_frame >= AVDISCARD_ALL)
+continue;
+
+ret = decode_nal_unit(s, nal);
 if (ret < 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] fate/hevc: add skip_loop_filter test

2017-12-05 Thread Stefan _
On 04.12.2017 at 18:49 Michael Niedermayer wrote:
> will apply
>
> can you add a fate test for this ?
>
> thanks
>
> [...]
Sure.

I've picked a random sample where skip_loop_filter={nokey,all} had 
different output. Hope that's fine.


From 2f4e5bf1e37d0fbfce0631ebb8e7011b5f8128f1 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Tue, 5 Dec 2017 12:47:47 +0100
Subject: [PATCH] fate/hevc: add skip_loop_filter test

---
 tests/fate/hevc.mak|  3 +++
 tests/ref/fate/hevc-skiploopfilter | 14 ++
 2 files changed, 17 insertions(+)
 create mode 100644 tests/ref/fate/hevc-skiploopfilter

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 5a3c156ee6..0e8859307d 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -239,6 +239,9 @@ fate-hevc-bsf-mp4toannexb: CMD = md5 -i $(TARGET_PATH)/tests/data/hevc-mp4.mov -
 fate-hevc-bsf-mp4toannexb: CMP = oneline
 fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9
 
+fate-hevc-skiploopfilter: CMD = framemd5 -skip_loop_filter nokey -i $(TARGET_SAMPLES)/hevc-conformance/SAO_D_Samsung_5.bit -sws_flags bitexact
+FATE_HEVC += fate-hevc-skiploopfilter
+
 FATE_HEVC-$(call DEMDEC, HEVC, HEVC) += $(FATE_HEVC)
 
 # this sample has two stsd entries and needs to reload extradata
diff --git a/tests/ref/fate/hevc-skiploopfilter b/tests/ref/fate/hevc-skiploopfilter
new file mode 100644
index 00..9c29909c51
--- /dev/null
+++ b/tests/ref/fate/hevc-skiploopfilter
@@ -0,0 +1,14 @@
+#format: frame checksums
+#version: 2
+#hash: MD5
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1920x1080
+#sar 0: 0/1
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,  3110400, 076c9288843ef1197a8cbef7f9a13fee
+0,  1,  1,1,  3110400, 6190eeea952805ebde69d22961aaeb45
+0,  2,  2,1,  3110400, 9aaa5111d5e6b25dcf5ddd19c58f17f7
+0,  3,  3,1,  3110400, 52a487e5f71b314e33e6632b4496f0a6
+0,  4,  4,1,  3110400, 13abb1c78313705b57a8298dc1e6c0e2
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] libavcodec/hevc_filter: support for all skip_loop_filter levels

2017-12-03 Thread Stefan _
On 01.12.2017 at 17:45 Michael Niedermayer wrote:
> AVDISCARD_NONREF is about frames which are not referenced by any other
> doesnt ff_hevc_frame_nb_refs() produce the number of references curently
> aka the other end of the reference arrows ?

Yes, that sounds right.

I've revised the patch to check for *_N NAL unit types instead (which 
should be equivalent to H.264's nal_idc == 0) and to skip not only 
deblock, but also SAO.

From a3ebeb4ca0849cfc3846de79b38ae5ca6c001718 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 30 Nov 2017 23:58:02 +0100
Subject: [PATCH] libavcodec/hevc_filter: support for all skip_loop_filter
 levels.

Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off.
---
 doc/decoders.texi|  7 ---
 libavcodec/hevc_filter.c | 29 +++--
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index d149d2bea5..a9510bdf02 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -25,13 +25,6 @@ enabled decoders.
 A description of some of the currently available video decoders
 follows.
 
-@section hevc
-
-HEVC / H.265 decoder.
-
-Note: the @option{skip_loop_filter} option has effect only at level
-@code{all}.
-
 @section rawvideo
 
 Raw video decoder.
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index b53f4cc721..94fb7cd3d1 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,9 +842,34 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 {
 int x_end = x >= s->ps.sps->width  - ctb_size;
-if (s->avctx->skip_loop_filter < AVDISCARD_ALL)
+int skip = 0, is_n = 0;
+switch (s->nal_unit_type) {
+case HEVC_NAL_TRAIL_N:
+case HEVC_NAL_TSA_N:
+case HEVC_NAL_STSA_N:
+case HEVC_NAL_RADL_N:
+case HEVC_NAL_RASL_N:
+case HEVC_NAL_VCL_N10:
+case HEVC_NAL_VCL_N12:
+case HEVC_NAL_VCL_N14:
+case HEVC_NAL_BLA_N_LP:
+case HEVC_NAL_IDR_N_LP:
+is_n = 1;
+break;
+default: break;
+}
+if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
+ s->sh.slice_type != HEVC_SLICE_I) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
+ s->sh.slice_type == HEVC_SLICE_B) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n))
+skip = 1;
+
+if (!skip)
 deblocking_filter_CTB(s, x, y);
-if (s->ps.sps->sao_enabled) {
+if (s->ps.sps->sao_enabled && !skip) {
 int y_end = y >= s->ps.sps->height - ctb_size;
 if (y && x)
 sao_filter_CTB(s, x - ctb_size, y - ctb_size);
-- 
2.15.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavcodec/hevc_filter: support for all skip_loop_filter levels

2017-11-30 Thread Stefan _
Hi,

Attached patch adds full support for skip_loop_filter (all levels) to 
the hevc decoder.

I'm not too sure about the implementation of "nonref", since this email 
(http://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/176116.html) 
mentions looking at nal_unit_type and temporal_id instead. Some help 
would be appreciated.

The 'make fate' test suite passed.

From 3e2f7152e3dab1f6cfe7c7e14f2ba1cee519978c Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Thu, 30 Nov 2017 23:58:02 +0100
Subject: [PATCH] libavcodec/hevc_filter: support for all skip_loop_filter
 levels.

Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off.
---
 doc/decoders.texi|  7 ---
 libavcodec/hevc_filter.c | 12 +++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index d149d2bea5..a9510bdf02 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -25,13 +25,6 @@ enabled decoders.
 A description of some of the currently available video decoders
 follows.
 
-@section hevc
-
-HEVC / H.265 decoder.
-
-Note: the @option{skip_loop_filter} option has effect only at level
-@code{all}.
-
 @section rawvideo
 
 Raw video decoder.
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index b53f4cc721..17ec59619f 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -842,7 +842,17 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 {
 int x_end = x >= s->ps.sps->width  - ctb_size;
-if (s->avctx->skip_loop_filter < AVDISCARD_ALL)
+int deblock = 1;
+if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
+ s->sh.slice_type != HEVC_SLICE_I) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
+ s->sh.slice_type == HEVC_SLICE_B) ||
+(s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
+ ff_hevc_frame_nb_refs(s) == 0))
+deblock = 0;
+if (deblock)
 deblocking_filter_CTB(s, x, y);
 if (s->ps.sps->sao_enabled) {
 int y_end = y >= s->ps.sps->height - ctb_size;
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat: LibreSSL (libtls) support

2017-11-04 Thread Stefan _
Attached patch adds support for LibreSSL. Instead of trying to implement 
support into the existing tls_openssl.c using lots of #ifdefs (which was 
rejected previously(?)) this adds a new TLS backend making use of the 
new libtls library.

Things to note:

- Haven't looked at LibreSSL's license closely, I assume that it has the 
same GPL licensing incompatibility as a derivative of OpenSSL (requires 
--enable-nonfree if --enable-gpl is used)

- ffrtmpcrypt support is not implemented since the bignum functions are 
not part of libtls itself

- Not sure why anyone would use libtls without pkg-config but supporting 
it probably doesn't hurt

I have tested all features (client mode, listen mode, cert/hostname 
verification) on both Alpine and Arch Linux.

Before michaelni asks again: Yes, the absence of my real name in git is 
intended.

From d4336b0733a1e582d7bf30795bf99df4cc60d7df Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Sat, 4 Nov 2017 15:45:16 +0100
Subject: [PATCH] libavformat: LibreSSL (libtls) support

Signed-off-by: sfan5 
---
 Changelog|   1 +
 configure|  16 ++--
 doc/protocols.texi   |   2 +-
 libavformat/Makefile |   1 +
 libavformat/tls_libtls.c | 207 +++
 5 files changed, 221 insertions(+), 6 deletions(-)
 create mode 100644 libavformat/tls_libtls.c

diff --git a/Changelog b/Changelog
index 8c45b2946d..bd37971af5 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ version :
   requires 2.1 (or later) and pkg-config.
 - VDA dropped (use VideoToolbox instead)
 - MagicYUV encoder
+- support LibreSSL (via libtls)
 
 
 version 3.4:
diff --git a/configure b/configure
index 1b0f064607..2938be7b07 100755
--- a/configure
+++ b/configure
@@ -215,7 +215,7 @@ External library support:
   --enable-gmp enable gmp, needed for rtmp(t)e support
if openssl or librtmp is not used [no]
   --enable-gnutls  enable gnutls, needed for https support
-   if openssl is not used [no]
+   if openssl or libtls is not used [no]
   --disable-iconv  disable iconv [autodetect]
   --enable-jni enable JNI support [no]
   --enable-ladspa  enable LADSPA audio filtering [no]
@@ -260,6 +260,8 @@ External library support:
   --enable-libssh  enable SFTP protocol via libssh [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
+  --enable-libtls  enable LibreSSL (via libtls), needed for https support
+   if openssl or gnutls is not used [no]
   --enable-libtwolame  enable MP2 encoding via libtwolame [no]
   --enable-libv4l2 enable libv4l2/v4l-utils [no]
   --enable-libvidstab  enable video stabilization using vid.stab [no]
@@ -292,7 +294,7 @@ External library support:
   --enable-opencl  enable OpenCL code
   --enable-opengl  enable OpenGL rendering [no]
   --enable-openssl enable openssl, needed for https support
-   if gnutls is not used [no]
+   if gnutls or libtls is not used [no]
   --disable-sndio  disable sndio support [autodetect]
   --disable-schannel   disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used [autodetect]
@@ -1563,6 +1565,7 @@ EXTERNAL_LIBRARY_NONFREE_LIST="
 libndi_newtek
 libfdk_aac
 openssl
+libtls
 "
 
 EXTERNAL_LIBRARY_VERSION3_LIST="
@@ -3135,6 +3138,7 @@ librtmpt_protocol_deps="librtmp"
 librtmpte_protocol_deps="librtmp"
 libsmbclient_protocol_deps="libsmbclient gplv3"
 libssh_protocol_deps="libssh"
+libtls_conflict="openssl gnutls"
 mmsh_protocol_select="http_protocol"
 mmst_protocol_select="network"
 rtmp_protocol_conflict="librtmp_protocol"
@@ -3152,13 +3156,13 @@ rtmpte_protocol_suggest="zlib"
 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
 rtmpts_protocol_suggest="zlib"
 rtp_protocol_select="udp_protocol"
-schannel_conflict="openssl gnutls"
+schannel_conflict="openssl gnutls libtls"
 sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
 sctp_protocol_select="network"
-securetransport_conflict="openssl gnutls"
+securetransport_conflict="openssl gnutls libtls"
 srtp_protocol_select="rtp_protocol srtp"
 tcp_protocol_select="network"
-tls_protocol_deps_any="gnutls openssl schannel securetransport"
+tls_protocol_deps_any="gnutls openssl schannel securetransport libtls"
 tls_protocol_select="tcp_protocol"
 udp_protocol_select="network"
 udplite_protocol_select="network"
@@ -6009,6 +6013,8 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h speex_decoder_init -lspeex
 enabled libtesseract  && require_pkg_config 

Re: [FFmpeg-devel] [PATCH] configure/rtmpdh: Fix OpenSSL 1.1.0 support

2017-02-23 Thread Stefan _
Am 23.02.2017 um 02:07 schrieb Michael Niedermayer:
> On Wed, Feb 22, 2017 at 11:15:45PM +0000, Stefan _ wrote:
>
>> From: sfan5 <sf...@live.de>
> Is it intended that theres no full name in the git author field ?
>
> [...]

Yes that's intended.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure/rtmpdh: Fix OpenSSL 1.1.0 support

2017-02-22 Thread Stefan _
The rtmpdh patch was kinda (completly) broken, fixed patch is attached.

Concerning LibreSSL:
They use OPENSSL_VERSION_NUMBER = 0x2050200fL which breaks the other 
openssl code in tls_openssl.c anyway,
so LibreSSL support should probably be worried about in a different patch.
From 0edf1d179824fa6400031c6d05b3f464f01abf36 Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Wed, 22 Feb 2017 15:38:16 +0100
Subject: [PATCH 2/2] rtmpdh: Stop using OpenSSL-provided DH functions to
 support 1.1.0

DH (struct dh_st) was made private in the 1.1 series, instead
DH is now done the same way as with gcrypt / libgmp.
---
 libavformat/rtmpdh.c | 94 
 libavformat/rtmpdh.h | 13 +++-
 2 files changed, 49 insertions(+), 58 deletions(-)

diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
index 1876fd44f9..1ec1286d23 100644
--- a/libavformat/rtmpdh.c
+++ b/libavformat/rtmpdh.c
@@ -54,7 +54,6 @@
 "F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \
 ""
 
-#if CONFIG_GMP || CONFIG_GCRYPT
 #if CONFIG_GMP
 #define bn_new(bn)  \
 do {\
@@ -93,7 +92,11 @@
 else\
 ret = 1;\
 } while (0)
-#define bn_modexp(bn, y, q, p)  mpz_powm(bn, y, q, p)
+#define bn_modexp(bn, y, q, p, ret) \
+do {\
+mpz_powm(bn, y, q, p);  \
+ret = 1;\
+} while(0)
 #define bn_random(bn, num_bits)   \
 do {  \
 int bits = num_bits;  \
@@ -125,8 +128,34 @@
 #define bn_bn2bin(bn, buf, len) gcry_mpi_print(GCRYMPI_FMT_USG, buf, len, NULL, bn)
 #define bn_bin2bn(bn, buf, len) gcry_mpi_scan(, GCRYMPI_FMT_USG, buf, len, NULL)
 #define bn_hex2bn(bn, buf, ret) ret = (gcry_mpi_scan(, GCRYMPI_FMT_HEX, buf, 0, 0) == 0)
-#define bn_modexp(bn, y, q, p)  gcry_mpi_powm(bn, y, q, p)
+#define bn_modexp(bn, y, q, p, ret) \
+do {\
+cry_mpi_powm(bn, y, q, p);  \
+ret = 1;\
+} while (0)
 #define bn_random(bn, num_bits) gcry_mpi_randomize(bn, num_bits, GCRY_WEAK_RANDOM)
+#elif CONFIG_OPENSSL
+#define bn_new(bn)  bn = BN_new()
+#define bn_free(bn) BN_free(bn)
+#define bn_set_word(bn, w)  BN_set_word(bn, w)
+#define bn_cmp(a, b)BN_cmp(a, b)
+#define bn_copy(to, from)   BN_copy(to, from)
+#define bn_sub_word(bn, w)  BN_sub_word(bn, w)
+#define bn_cmp_1(bn)BN_cmp(bn, BN_value_one())
+#define bn_num_bytes(bn)BN_num_bytes(bn)
+#define bn_bn2bin(bn, buf, len) BN_bn2bin(bn, buf)
+#define bn_bin2bn(bn, buf, len) bn = BN_bin2bn(buf, len, 0)
+#define bn_hex2bn(bn, buf, ret) ret = BN_hex2bn(, buf)
+#define bn_modexp(bn, y, q, p, ret)  \
+do { \
+BN_CTX *ctx = BN_CTX_new();  \
+if (!ctx)\
+ret = 0; \
+else \
+ret = BN_mod_exp(bn, y, q, p, ctx);  \
+BN_CTX_free(ctx);\
+} while (0)
+#define bn_random(bn, num_bits)BN_rand(bn, num_bits, 0, 0)
 #endif
 
 #define MAX_BYTES 18000
@@ -135,7 +164,7 @@
 
 static FFBigNum dh_generate_key(FF_DH *dh)
 {
-int num_bytes;
+int num_bytes, ret;
 
 num_bytes = bn_num_bytes(dh->p) - 1;
 if (num_bytes <= 0 || num_bytes > MAX_BYTES)
@@ -152,7 +181,9 @@ static FFBigNum dh_generate_key(FF_DH *dh)
 return NULL;
 }
 
-bn_modexp(dh->pub_key, dh->g, dh->priv_key, dh->p);
+bn_modexp(dh->pub_key, dh->g, dh->priv_key, dh->p, ret);
+if (!ret)
+return NULL;
 
 return dh->pub_key;
 }
@@ -161,12 +192,15 @@ static int dh_compute_key(FF_DH *dh, FFBigNum pub_key_bn,
   uint32_t secret_key_len, uint8_t *secret_key)
 {
 FFBigNum k;
+int ret;
 
 bn_new(k);
 if (!k)
 return -1;
 
-bn_modexp(k, pub_key_bn, dh->priv_key, dh->p);
+bn_modexp(k, pub_key_bn, dh->priv_key, dh->p, ret);
+if (!ret)
+return -1;
 bn_bn2bin(k, secret_key, secret_key_len);
 bn_free(k);
 
@@ -184,53 +218,11 @@ void ff_dh_free(FF_DH *dh)
 bn_free(dh->priv_key);
 av_free(dh);
 }
-#elif CONFIG_OPENSSL
-#define bn_new(bn)  bn = BN_new()
-#define bn_free(bn) BN_free(bn)
-#define bn_set_word(bn, w)  BN_set_word(bn, w)
-#define bn_cmp(a, b)BN_cmp(a, b)
-#define bn_copy(to, from)   BN_copy(to, from)
-#define bn_sub_word(bn, w)  BN_sub_word(bn, w)
-#define bn_cmp_1(bn)BN_cmp(bn, BN_value_one())
-#define bn_num_bytes(bn)

[FFmpeg-devel] [PATCH] configure/rtmpdh: Fix OpenSSL 1.1.0 support

2017-02-22 Thread Stefan _
1) configure only looks for OPENSSL_init_ssl using pkg-config, this 
breaks in case pkg-config is not available (cross-compiling)


2) The rtmpdh code uses the DH struct from OpenSSL which was made 
private in the 1.1 series


From 5cc140f85d8d7551ac0a2c51d5023bd8ba75ba4b Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Wed, 22 Feb 2017 15:35:57 +0100
Subject: [PATCH 1/2] configure: Support OpenSSL 1.1.0 without pkg-config

---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 6431313814..16db9edc1b 100755
--- a/configure
+++ b/configure
@@ -5892,6 +5892,7 @@ enabled omx   && { check_header OMX_Core.h ||
die "ERROR: OpenMAX IL headers not found"; }
 enabled openssl   && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl ||
use_pkg_config openssl openssl/ssl.h SSL_library_init ||
+   check_lib openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
-- 
2.11.1

From ee02425f851d0c9cfb8a892f385394efe5b4fdda Mon Sep 17 00:00:00 2001
From: sfan5 
Date: Wed, 22 Feb 2017 15:38:16 +0100
Subject: [PATCH 2/2] rtmpdh: Support OpenSSL 1.1.0

DH (struct dh_st) was made private in the 1.1 series, a replacement
similar to the FF_DH struct for gcrypt/gmp is used instead.
---
 libavformat/rtmpdh.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/rtmpdh.h b/libavformat/rtmpdh.h
index 2b250f595d..2d1489b193 100644
--- a/libavformat/rtmpdh.h
+++ b/libavformat/rtmpdh.h
@@ -48,10 +48,19 @@ typedef struct FF_DH {
 #elif CONFIG_OPENSSL
 #include 
 #include 
+#include 
 
 typedef BIGNUM *FFBigNum;
+#if OPENSSL_VERSION_NUMBER >= 0x101fL
+typedef struct {
+BIGNUM *p, *g;
+BIGNUM *pub_key, *priv_key;
+long length;
+} FF_DH;
+#else
 typedef DH FF_DH;
 #endif
+#endif
 
 /**
  * Initialize a Diffie-Hellmann context.
-- 
2.11.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/muxers/mpegts: update doc after adding flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-25 Thread Stefan Pöschel
> Gesendet: Donnerstag, 24. Dezember 2015 um 02:50 Uhr
> Von: "Michael Niedermayer" <mich...@niedermayer.cc>
> An: "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org>
> Betreff: Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an 
> AC-3/E-AC-3 ES the DVB way
>
> On Sun, Dec 13, 2015 at 11:54:32AM +0100, Stefan Pöschel wrote:
> > So far an AC-3 elementary stream is refered to in the PMT according to
> > System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) 
> > way.
> > To fix this inconsistency, this commit changes the default E-AC-3 behaviour 
> > to
> > use the ATSC way, too. Furthermore a new flag is added to optionally select 
> > the
> > DVB way (regarding both codecs and possible further differences in the 
> > future).
> > ---
> >  libavformat/mpegts.h|  1 +
> >  libavformat/mpegtsenc.c | 20 ++--
> >  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> patch applied
> 
> please also send one to update the docs
> 
> thanks
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB


Date: Fri, 25 Dec 2015 10:28:58 +0100
Subject: [PATCH] doc/muxers/mpegts: update doc after adding flag to embed an 
AC-3/E-AC-3 ES the DVB way

---
 doc/muxers.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index b6d8823..a308d3d 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -858,6 +858,8 @@ Reemit PAT/PMT before writing the next packet.
 Use LATM packetization for AAC.
 @item pat_pmt_at_frames
 Reemit PAT and PMT at each video frame.
+@item system_b
+Conform to System B (DVB) instead of System A (ATSC).
 @end table
 
 @subsection Example
-- 
1.9.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-23 Thread Stefan Pöschel
Just wanted to ask if there is any further information needed regarding my 
patch.

> Gesendet: Sonntag, 13. Dezember 2015 um 11:54 Uhr
> Von: "Stefan Pöschel" <basic.mas...@gmx.de>
> An: ffmpeg-devel@ffmpeg.org
> Betreff: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an 
> AC-3/E-AC-3 ES the DVB way
>
> So far an AC-3 elementary stream is refered to in the PMT according to
> System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
> To fix this inconsistency, this commit changes the default E-AC-3 behaviour to
> use the ATSC way, too. Furthermore a new flag is added to optionally select 
> the
> DVB way (regarding both codecs and possible further differences in the 
> future).
> ---
>  libavformat/mpegts.h|  1 +
>  libavformat/mpegtsenc.c | 20 ++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 84f3098..0cdbc76 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -60,6 +60,7 @@
>  #define STREAM_TYPE_AUDIO_AC3   0x81
>  #define STREAM_TYPE_AUDIO_DTS   0x82
>  #define STREAM_TYPE_AUDIO_TRUEHD0x83
> +#define STREAM_TYPE_AUDIO_EAC3  0x87
> 
>  typedef struct MpegTSContext MpegTSContext;
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 19032f3..cb11c31 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -99,6 +99,7 @@ typedef struct MpegTSWrite {
>  #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
>  #define MPEGTS_FLAG_AAC_LATM0x02
>  #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES   0x04
> +#define MPEGTS_FLAG_SYSTEM_B0x08
>  int flags;
>  int copyts;
>  int tables_version;
> @@ -319,7 +320,14 @@ static int mpegts_write_pmt(AVFormatContext *s, 
> MpegTSService *service)
>  stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
>  break;
>  case AV_CODEC_ID_AC3:
> -stream_type = STREAM_TYPE_AUDIO_AC3;
> +stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
> +  ? STREAM_TYPE_PRIVATE_DATA
> +  : STREAM_TYPE_AUDIO_AC3;
> +break;
> +case AV_CODEC_ID_EAC3:
> +stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
> +  ? STREAM_TYPE_PRIVATE_DATA
> +  : STREAM_TYPE_AUDIO_EAC3;
>  break;
>  case AV_CODEC_ID_DTS:
>  stream_type = STREAM_TYPE_AUDIO_DTS;
> @@ -343,7 +351,12 @@ static int mpegts_write_pmt(AVFormatContext *s, 
> MpegTSService *service)
>  /* write optional descriptors here */
>  switch (st->codec->codec_type) {
>  case AVMEDIA_TYPE_AUDIO:
> -if (st->codec->codec_id==AV_CODEC_ID_EAC3) {
> +if (st->codec->codec_id==AV_CODEC_ID_AC3 && (ts->flags & 
> MPEGTS_FLAG_SYSTEM_B)) {
> +*q++=0x6a; // AC3 descriptor see A038 DVB SI
> +*q++=1; // 1 byte, all flags sets to 0
> +*q++=0; // omit all fields...
> +}
> +if (st->codec->codec_id==AV_CODEC_ID_EAC3 && (ts->flags & 
> MPEGTS_FLAG_SYSTEM_B)) {
>  *q++=0x7a; // EAC3 descriptor see A038 DVB SI
>  *q++=1; // 1 byte, all flags sets to 0
>  *q++=0; // omit all fields...
> @@ -1790,6 +1803,9 @@ static const AVOption options[] = {
>  { "pat_pmt_at_frames", "Reemit PAT and PMT at each video frame",
>0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_PAT_PMT_AT_FRAMES}, 0, 
> INT_MAX,
>AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
> +{ "system_b", "Conform to System B (DVB) instead of System A (ATSC)",
> +  0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_SYSTEM_B }, 0, INT_MAX,
> +  AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
>  // backward compatibility
>  { "resend_headers", "Reemit PAT/PMT before writing the next packet",
>offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT,
> -- 
> 2.6.4
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-17 Thread Stefan Pöschel
*bump*

Am 13.12.2015 um 15:23 schrieb Stefan Pöschel:
> Am 13.12.2015 um 14:18 schrieb Moritz Barsnick:
>> On Sun, Dec 13, 2015 at 11:54:32 +0100, Stefan Pöschel wrote:
>>> So far an AC-3 elementary stream is refered to in the PMT according to
>>> System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) 
>>> way.
>>
>> Interesting, that's apparently the reason why my (DVB-)PVR didn't ever
>> recognize AC-3 in MPEG-TS. See
>> https://ffmpeg.org/pipermail/ffmpeg-user/2015-October/028812.html
>> E-AC-3 in MPEG-TS seems to have worked (I just tried it - successfully
>> - for the first time), I didn't realize that.
>>
>> With your patch, I can now successfully play AC-3 and E-AC-3 with that
>> player, when using the "-mpegts_flags system_b" (and kill this
>> capability when not using it).
> 
> I've had the same problem which was the motivation to take a look into it.
> 
>>> To fix this inconsistency, this commit changes the default E-AC-3 behaviour 
>>> to
>>> use the ATSC way, too. Furthermore a new flag is added to optionally select 
>>> the
>>> DVB way (regarding both codecs and possible further differences in the 
>>> future).
>>
>> I never found the patch mentioned in the thread, and don't know enough
>> about the differences myself.
> 
> There is a bug report of libav regarding this problem, together with a
> patch from 2011 which just changes the AC-3 signalling from ATSC to DVB:
> https://bugzilla.libav.org/show_bug.cgi?id=73
> 
> Yesterday I therefore posted a patch to libav-devel (similar to this one
> for FFmpeg-devel) for switching between ATSC and DVB:
> https://lists.libav.org/pipermail/libav-devel/2015-December/073574.html
> 
> Regards,
>   Stefan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-13 Thread Stefan Pöschel
So far an AC-3 elementary stream is refered to in the PMT according to
System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
To fix this inconsistency, this commit changes the default E-AC-3 behaviour to
use the ATSC way, too. Furthermore a new flag is added to optionally select the
DVB way (regarding both codecs and possible further differences in the future).
---
 libavformat/mpegts.h|  1 +
 libavformat/mpegtsenc.c | 20 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index 84f3098..0cdbc76 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -60,6 +60,7 @@
 #define STREAM_TYPE_AUDIO_AC3   0x81
 #define STREAM_TYPE_AUDIO_DTS   0x82
 #define STREAM_TYPE_AUDIO_TRUEHD0x83
+#define STREAM_TYPE_AUDIO_EAC3  0x87

 typedef struct MpegTSContext MpegTSContext;

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 19032f3..cb11c31 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -99,6 +99,7 @@ typedef struct MpegTSWrite {
 #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
 #define MPEGTS_FLAG_AAC_LATM0x02
 #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES   0x04
+#define MPEGTS_FLAG_SYSTEM_B0x08
 int flags;
 int copyts;
 int tables_version;
@@ -319,7 +320,14 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
 break;
 case AV_CODEC_ID_AC3:
-stream_type = STREAM_TYPE_AUDIO_AC3;
+stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
+  ? STREAM_TYPE_PRIVATE_DATA
+  : STREAM_TYPE_AUDIO_AC3;
+break;
+case AV_CODEC_ID_EAC3:
+stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
+  ? STREAM_TYPE_PRIVATE_DATA
+  : STREAM_TYPE_AUDIO_EAC3;
 break;
 case AV_CODEC_ID_DTS:
 stream_type = STREAM_TYPE_AUDIO_DTS;
@@ -343,7 +351,12 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 /* write optional descriptors here */
 switch (st->codec->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
-if (st->codec->codec_id==AV_CODEC_ID_EAC3) {
+if (st->codec->codec_id==AV_CODEC_ID_AC3 && (ts->flags & 
MPEGTS_FLAG_SYSTEM_B)) {
+*q++=0x6a; // AC3 descriptor see A038 DVB SI
+*q++=1; // 1 byte, all flags sets to 0
+*q++=0; // omit all fields...
+}
+if (st->codec->codec_id==AV_CODEC_ID_EAC3 && (ts->flags & 
MPEGTS_FLAG_SYSTEM_B)) {
 *q++=0x7a; // EAC3 descriptor see A038 DVB SI
 *q++=1; // 1 byte, all flags sets to 0
 *q++=0; // omit all fields...
@@ -1790,6 +1803,9 @@ static const AVOption options[] = {
 { "pat_pmt_at_frames", "Reemit PAT and PMT at each video frame",
   0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_PAT_PMT_AT_FRAMES}, 0, 
INT_MAX,
   AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
+{ "system_b", "Conform to System B (DVB) instead of System A (ATSC)",
+  0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_SYSTEM_B }, 0, INT_MAX,
+  AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
 // backward compatibility
 { "resend_headers", "Reemit PAT/PMT before writing the next packet",
   offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT,
-- 
2.6.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-13 Thread Stefan Pöschel
Am 13.12.2015 um 14:18 schrieb Moritz Barsnick:
> On Sun, Dec 13, 2015 at 11:54:32 +0100, Stefan Pöschel wrote:
>> So far an AC-3 elementary stream is refered to in the PMT according to
>> System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
> 
> Interesting, that's apparently the reason why my (DVB-)PVR didn't ever
> recognize AC-3 in MPEG-TS. See
> https://ffmpeg.org/pipermail/ffmpeg-user/2015-October/028812.html
> E-AC-3 in MPEG-TS seems to have worked (I just tried it - successfully
> - for the first time), I didn't realize that.
> 
> With your patch, I can now successfully play AC-3 and E-AC-3 with that
> player, when using the "-mpegts_flags system_b" (and kill this
> capability when not using it).

I've had the same problem which was the motivation to take a look into it.

>> To fix this inconsistency, this commit changes the default E-AC-3 behaviour 
>> to
>> use the ATSC way, too. Furthermore a new flag is added to optionally select 
>> the
>> DVB way (regarding both codecs and possible further differences in the 
>> future).
> 
> I never found the patch mentioned in the thread, and don't know enough
> about the differences myself.

There is a bug report of libav regarding this problem, together with a
patch from 2011 which just changes the AC-3 signalling from ATSC to DVB:
https://bugzilla.libav.org/show_bug.cgi?id=73

Yesterday I therefore posted a patch to libav-devel (similar to this one
for FFmpeg-devel) for switching between ATSC and DVB:
https://lists.libav.org/pipermail/libav-devel/2015-December/073574.html

Regards,
Stefan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] mpegtsenc: signalling of AC-3 and E-AC-3 according to ATSC/DVB

2015-12-12 Thread Stefan Pöschel
[sorry, used wrong sender previously]


Hi,

within the MPEG-TS muxer, the signalling of AC-3 is done according to
System A (ATSC) while in contrast E-AC-3 is signalled according to
System B (DVB).
To fix this inconsistency, E-AC-3 should IMO be signalled according to
System A, too. Furthermore a flag for the mpegts_flags param should be
added to optionally switch the behaviour (regarding both codecs) to
System B conformity.

IMO it makes more sense to change the E-AC-3 behaviour to ATSC instead
of the AC-3 behaviour to DVB, as the AC-3 behaviour is older (E-AC-3 is
present in FFmpeg code since 2011).

If there are no objections against my proposal, I would write and post a
regarding patch.

Thanks and regards,
Stefan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel