Re: [FFmpeg-devel] [PATCH 16/17] hwcontext_vaapi: Move better-matching surface formats earlier

2017-11-24 Thread Jun Zhao


On 2017/11/24 8:51, Mark Thompson wrote:
> In particular, avoid selecting YV12/YV16 when I420/422H are available.
> ---
>  libavutil/hwcontext_vaapi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index fcff25dc9b..2f47162a0d 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -99,15 +99,15 @@ static const struct {
>  enum AVPixelFormat pix_fmt;
>  } vaapi_format_map[] = {
>  MAP(NV12, YUV420,  NV12),
> -MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
> -MAP(IYUV, YUV420,  YUV420P),
>  #ifdef VA_FOURCC_I420
>  MAP(I420, YUV420,  YUV420P),
>  #endif
> +MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
> +MAP(IYUV, YUV420,  YUV420P),
> +MAP(422H, YUV422,  YUV422P),
Can we give a flag or other field to identify the map priority, not use
the hard code array index order ?     
>  #ifdef VA_FOURCC_YV16
>  MAP(YV16, YUV422,  YUV422P), // With U/V planes swapped.
>  #endif
> -MAP(422H, YUV422,  YUV422P),
>  MAP(UYVY, YUV422,  UYVY422),
>  MAP(YUY2, YUV422,  YUYV422),
>  MAP(Y800, YUV400,  GRAY8),

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


Re: [FFmpeg-devel] [PATCH] hwcontext_d3d11va: properly reset values after release/close

2017-11-24 Thread Jan Ekstrom
On Nov 24, 2017 03:01, "Jan Ekström"  wrote:

Makes the uninit function re-entrable, which can be a common case
when an API user first tries to initialize its context, fails, and
then finally unrefs the AVHWDevice.

Fixes a crash reported by sm2345 on IRC


Relevant backtrace I received from the user:

https://pastebin.com/MtWTEgmc

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


Re: [FFmpeg-devel] [PATCH] hwcontext_d3d11va: properly reset values after release/close

2017-11-24 Thread Hendrik Leppkes
On Fri, Nov 24, 2017 at 2:01 AM, Jan Ekström  wrote:
> Makes the uninit function re-entrable, which can be a common case
> when an API user first tries to initialize its context, fails, and
> then finally unrefs the AVHWDevice.
>
> Fixes a crash reported by sm2345 on IRC.
> ---
>  libavutil/hwcontext_d3d11va.c | 21 -
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
> index 65dd6651fc..845a4a45fe 100644
> --- a/libavutil/hwcontext_d3d11va.c
> +++ b/libavutil/hwcontext_d3d11va.c
> @@ -458,20 +458,31 @@ static void d3d11va_device_uninit(AVHWDeviceContext 
> *hwdev)
>  {
>  AVD3D11VADeviceContext *device_hwctx = hwdev->hwctx;
>
> -if (device_hwctx->device)
> +if (device_hwctx->device) {
>  ID3D11Device_Release(device_hwctx->device);
> +device_hwctx->device = NULL;
> +}
>
> -if (device_hwctx->device_context)
> +if (device_hwctx->device_context) {
>  ID3D11DeviceContext_Release(device_hwctx->device_context);
> +device_hwctx->device_context = NULL;
> +}
>
> -if (device_hwctx->video_device)
> +if (device_hwctx->video_device) {
>  ID3D11VideoDevice_Release(device_hwctx->video_device);
> +device_hwctx->video_device = NULL;
> +}
>
> -if (device_hwctx->video_context)
> +if (device_hwctx->video_context) {
>  ID3D11VideoContext_Release(device_hwctx->video_context);
> +device_hwctx->video_context = NULL;
> +}
>
> -if (device_hwctx->lock == d3d11va_default_lock)
> +if (device_hwctx->lock == d3d11va_default_lock) {
>  CloseHandle(device_hwctx->lock_ctx);
> +device_hwctx->lock_ctx = INVALID_HANDLE_VALUE;
> +device_hwctx->lock = NULL;
> +}
>  }
>

LGTM. In some cases the uninit can be called twice, which seems like a
bit of an odd design, but we better don't leak any pointers out then.
Should probably go through the other hwcontext implementation to check
for similar problems.

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


Re: [FFmpeg-devel] [PATCH 02/17] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-24 Thread Timo Rothenpieler

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 806dab2074..3bd2409ea2 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -32,6 +32,7 @@
  
  #include "avcodec.h"

  #include "decode.h"
+#include "hwaccel.h"
  #include "internal.h"
  
  typedef struct CuvidContext

@@ -1094,6 +1095,19 @@ static const AVOption options[] = {
  { NULL }
  };
  
+static const AVCodecHWConfigInternal *cuvid_hw_configs[] = {

+&(const AVCodecHWConfigInternal) {
+.public = {
+.pix_fmt = AV_PIX_FMT_CUDA,
+.methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
+   AV_CODEC_HW_CONFIG_METHOD_INTERNAL,
+.device_type = AV_HWDEVICE_TYPE_CUDA
+},
+.hwaccel = NULL,
+},
+NULL
+};
+
  #define DEFINE_CUVID_CODEC(x, X) \
  static const AVClass x##_cuvid_class = { \
  .class_name = #x "_cuvid", \
@@ -1127,6 +1141,7 @@ static const AVOption options[] = {
  AV_PIX_FMT_P010, \
  AV_PIX_FMT_P016, \
  AV_PIX_FMT_NONE }, \
+.hw_configs = cuvid_hw_configs, \
  };
  
  #if CONFIG_HEVC_CUVID_DECODER


ok



smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 1/3] avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 doc/muxers.texi  | 12 ++
 libavformat/hlsenc.c | 63 ++--
 2 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 9d9ca31..7e6d594 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -831,6 +831,18 @@ be a video only stream with video bitrate 1000k, the 
second variant stream will
 be an audio only stream with bitrate 64k and the third variant stream will be a
 video only stream with bitrate 256k. Here, three media playlist with file names
 out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created.
+@example
+ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k  \
+  -map 0:a -map 0:a -map 0:v -map 0:v -f hls \
+  -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low 
v:1,agroup:aud_high" \
+  -master_pl_name master.m3u8 \
+  http://example.com/live/out.m3u8
+@end example
+This example creates two audio only and two video only variant streams. In
+addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
+playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
+and they are mapped to the two video only variant streams with audio group 
names
+'aud_low' and 'aud_high'.
 
 By default, a single hls variant containing all the encoded streams is created.
 
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 30ccf73..58d7c58 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -147,6 +147,7 @@ typedef struct VariantStream {
 AVStream **streams;
 unsigned int nb_streams;
 int m3u8_created; /* status of media play-list creation */
+char *agroup; /* audio group name */
 char *baseurl;
 } VariantStream;
 
@@ -1069,7 +1070,7 @@ static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
 HLSContext *hls = s->priv_data;
-VariantStream *vs;
+VariantStream *vs, *temp_vs;
 AVStream *vid_st, *aud_st;
 AVIOContext *master_pb = 0;
 AVDictionary *options = NULL;
@@ -1104,6 +1105,34 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, "#EXTM3U\n");
 avio_printf(master_pb, "#EXT-X-VERSION:%d\n", hls->version);
 
+/* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/
+for (i = 0; i < hls->nb_varstreams; i++) {
+vs = &(hls->var_streams[i]);
+
+if (vs->has_video || vs->has_subtitle || !vs->agroup)
+continue;
+
+m3u8_name_size = strlen(vs->m3u8_name) + 1;
+m3u8_rel_name = av_malloc(m3u8_name_size);
+if (!m3u8_rel_name) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size);
+ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
+   m3u8_rel_name, m3u8_name_size);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
+goto fail;
+}
+
+avio_printf(master_pb, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"",
+vs->agroup);
+avio_printf(master_pb, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n",
+m3u8_rel_name);
+av_freep(&m3u8_rel_name);
+}
+
 /* For variant streams with video add #EXT-X-STREAM-INF tag with 
attributes*/
 for (i = 0; i < hls->nb_varstreams; i++) {
 vs = &(hls->var_streams[i]);
@@ -1136,6 +1165,25 @@ static int create_master_playlist(AVFormatContext *s,
 continue;
 }
 
+/**
+ * Traverse through the list of audio only rendition streams and find
+ * the rendition which has highest bitrate in the same audio group
+ */
+if (vs->agroup) {
+for (j = 0; j < hls->nb_varstreams; j++) {
+temp_vs = &(hls->var_streams[j]);
+if (!temp_vs->has_video && !temp_vs->has_subtitle &&
+temp_vs->agroup &&
+!strcmp(temp_vs->agroup, vs->agroup)) {
+if (!aud_st)
+aud_st = temp_vs->streams[0];
+if (temp_vs->streams[0]->codecpar->bit_rate >
+aud_st->codecpar->bit_rate)
+aud_st = temp_vs->streams[0];
+}
+}
+}
+
 bandwidth = 0;
 if (vid_st)
 bandwidth += vid_st->codecpar->bit_rate;
@@ -1154,6 +1202,10 @@ static int create_master_playlist(AVFormatContext *s,
 if (vid_st && vid_st->codecpar->width > 0 && vid_st->codecpar->height 
> 0)
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
+
+if (vs->agroup && aud_st)
+avio_printf(master_pb, ",AUDIO=\"group_%s\"", vs->agroup);
+
 avio_printf(master_pb, "\n%s\n\n", m3u8

[FFmpeg-devel] [PATCH v2 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavcodec/libx264.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91..6b93aa8 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -454,6 +454,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
 X264Context *x4 = avctx->priv_data;
 AVCPBProperties *cpb_props;
 int sw,sh;
+x264_nal_t *nal;
+uint8_t *p;
+int nnal, s, i;
 
 if (avctx->global_quality > 0)
 av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is 
recommended.\n");
@@ -799,12 +802,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!x4->enc)
 return AVERROR_EXTERNAL;
 
-if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
-x264_nal_t *nal;
-uint8_t *p;
-int nnal, s, i;
+s = x264_encoder_headers(x4->enc, &nal, &nnal);
+avctx->profile = nal->p_payload[5];
+avctx->level = nal->p_payload[7];
 
-s = x264_encoder_headers(x4->enc, &nal, &nnal);
+if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!p)
 return AVERROR(ENOMEM);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH v2 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavformat/hlsenc.c | 65 +++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 58d7c58..8a634de 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1066,6 +1066,62 @@ static int get_relative_url(const char *master_url, 
const char *media_url,
 return 0;
 }
 
+static char *get_codec_str(AVStream *vid_st, AVStream *aud_st) {
+size_t codec_str_size = 64;
+char *codec_str = av_malloc(codec_str_size);
+int video_str_len = 0;
+
+if (!codec_str)
+return NULL;
+
+if (!vid_st && !aud_st) {
+goto fail;
+}
+
+if (vid_st) {
+if (vid_st->codecpar->profile != FF_PROFILE_UNKNOWN &&
+vid_st->codecpar->level != FF_LEVEL_UNKNOWN &&
+vid_st->codecpar->codec_id == AV_CODEC_ID_H264) {
+/* TODO : Set constraint_set flags correctly. Hardcoded to 0 here. 
*/
+snprintf(codec_str, codec_str_size, "avc1.%02x00%02x",
+ vid_st->codecpar->profile, vid_st->codecpar->level);
+} else {
+goto fail;
+}
+video_str_len = strlen(codec_str);
+}
+
+if (aud_st) {
+char *audio_str = codec_str;
+if (video_str_len) {
+codec_str[video_str_len] = ',';
+video_str_len += 1;
+audio_str += video_str_len;
+codec_str_size -= video_str_len;
+}
+if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP2) {
+snprintf(audio_str, codec_str_size, "mp4a.40.33");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP3) {
+snprintf(audio_str, codec_str_size, "mp4a.40.34");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AAC) {
+/* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 
5 and 29 respectively */
+snprintf(audio_str, codec_str_size, "mp4a.40.2");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A5");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A6");
+} else {
+goto fail;
+}
+}
+
+return codec_str;
+
+fail:
+av_free(codec_str);
+return NULL;
+}
+
 static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
@@ -1076,7 +1132,7 @@ static int create_master_playlist(AVFormatContext *s,
 AVDictionary *options = NULL;
 unsigned int i, j;
 int m3u8_name_size, ret, bandwidth;
-char *m3u8_rel_name;
+char *m3u8_rel_name, *codec_str;
 
 input_vs->m3u8_created = 1;
 if (!hls->master_m3u8_created) {
@@ -1203,6 +1259,13 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
 
+codec_str = get_codec_str(vid_st, aud_st);
+
+if (codec_str) {
+avio_printf(master_pb, ",CODECS=\"%s\"", codec_str);
+av_free(codec_str);
+}
+
 if (vs->agroup && aud_st)
 avio_printf(master_pb, ",AUDIO=\"group_%s\"", vs->agroup);
 
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Jeyapal, Karthick
Since Vishwanath is on leave today, I have made the changes required and have 
sent patchset v2.

On 11/23/17, 4:11 PM, "Carl Eugen Hoyos"  wrote:

>2017-11-23 4:37 GMT+01:00  :
>> From: Vishwanath Dixit 
>>
>> Signed-off-by: Karthick J 
>> ---
>>  libavformat/hlsenc.c | 67 
>> +++-
>>  1 file changed, 66 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 9fed6a3..32246c4 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1065,6 +1065,52 @@ static int get_relative_url(const char *master_url, 
>> const char *media_url,
>>  return 0;
>>  }
>>
>> +static void get_codec_str(AVStream *vid_st, AVStream *aud_st, char *vcodec,
>> +  char *acodec, int vcodec_len, int acodec_len) {
>
>> +if (vcodec_len > 0)
>> +vcodec[0] = '\0';
>> +else
>> +return;
>> +
>> +if (acodec_len > 0)
>> +acodec[0] = '\0';
>> +else
>> +return;
>
>What are these supposed to do?
>Actually: Please add a line below to avoid these.
Made it based on av_malloc inside the function and caller has to free it. 
Now the code has become much simpler
>
>> +
>> +if (!vid_st && !aud_st) {
>> +av_log(NULL, AV_LOG_WARNING, "Atleast one stream shoud be valid\n");
>> +return;
>> +}
>
>This looks like the wrong place for such a check.
I have removed the warning, as it is a wrong place. 
Retaining the sanity check tough.
>
>> +
>> +if (vid_st && vid_st->codecpar->profile != FF_PROFILE_UNKNOWN &&
>> +vid_st->codecpar->level != FF_LEVEL_UNKNOWN &&
>> +vid_st->codecpar->codec_id == AV_CODEC_ID_H264) {
>> +snprintf(vcodec, vcodec_len, "avc1.%02x00%02x",
>> +vid_st->codecpar->profile, vid_st->codecpar->level);
>> +}
>
>The rfc does not specify a string for unknown profile?
Couldn’t find any explicit mention for unknown profile. 
https://tools.ietf.org/html/rfc6381

>
>> +
>> +if (aud_st) {
>> +if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP2) {
>> +snprintf(acodec, acodec_len, "mp4a.40.33");
>> +} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP3) {
>> +snprintf(acodec, acodec_len, "mp4a.40.34");
>> +} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>
>> +/* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set 
>> to 5 and 29 respectively */
>
>Yes.
>Is this the only special case already known?
No. Also we are not setting constrained_set flags of H264 properly. Have added 
a TODO there also.
>
>> +snprintf(acodec, acodec_len, "mp4a.40.2");
>> +} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AC3) {
>> +snprintf(acodec, acodec_len, "mp4a.A5");
>> +} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
>> +snprintf(acodec, acodec_len, "mp4a.A6");
>> +}
>> +}
>> +
>> +// either provide codec string for both active streams or for none
>> +if (vid_st && aud_st && (!strlen(vcodec) || !strlen(acodec))) {
>> +acodec[0] = vcodec[0] = '\0';
>> +av_log(NULL, AV_LOG_INFO, "Codec string not available for audio or 
>> video stream\n");
>> +}
>
>This needs a context and maybe a higher verbosity.
>
>> +}
>> +
>>  static int create_master_playlist(AVFormatContext *s,
>>VariantStream * const input_vs)
>>  {
>> @@ -1075,7 +1121,7 @@ static int create_master_playlist(AVFormatContext *s,
>>  AVDictionary *options = NULL;
>>  unsigned int i, j;
>>  int m3u8_name_size, ret, bandwidth;
>> -char *m3U8_rel_name;
>> +char *m3U8_rel_name, vcodec[32], acodec[32];
>
>I suspect you should initialize the first byte here to
>avoid the check on top.
>
>>
>>  input_vs->m3u8_created = 1;
>>  if (!hls->master_m3u8_created) {
>> @@ -1203,6 +1249,25 @@ static int create_master_playlist(AVFormatContext *s,
>>  avio_printf(master_pb, ",RESOLUTION=%dx%d", 
>> vid_st->codecpar->width,
>>  vid_st->codecpar->height);
>>
>> +get_codec_str(vid_st, aud_st, vcodec, acodec, sizeof(vcodec),
>> +  sizeof(acodec));
>
>Imo, use defines instead of sizeof() here.
>
>> +if (strlen(vcodec) || strlen(acodec))
>
>Even if not speed-critical code, checking the first byte
>may be simpler.
>
>Using "{" here simplifies the code below.
>

regards,
Karthick


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


Re: [FFmpeg-devel] [PATCH v2 3/3] libavformat/hlsenc: Persistent HTTP connections supported as an option

2017-11-24 Thread Jeyapal, Karthick
On 11/22/17, 1:27 PM, "Jeyapal, Karthick"  wrote:

>>On 11/22/17, 9:32 AM, "刘歧"  wrote:
>>
>>This patch is ok, but i see it need an API: ffio_geturlcontext
>>
>>it in the other patch, i see it have some thing need talk? If that is ok, 
>>this patch should be apply.
>Thanks for the reply. 
>All concerns raised by Nicolas has been addressed in this latest patch set.
>Let us wait for few days to check if anyone still has any objections.
Looks like nobody has anymore objections to this patchset. 
Well, it has already passed through multiple rounds of reviews.
Could somebody please push this to the master. 
I have few more patches waiting to be submitted, dependent on this feature.
>>
>>Thanks

regards,
Karthick



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


Re: [FFmpeg-devel] [PATCH v2 3/3] libavformat/hlsenc: Persistent HTTP connections supported as an option

2017-11-24 Thread 刘歧

> 在 2017年11月24日,18:02,Jeyapal, Karthick  写道:
> 
> On 11/22/17, 1:27 PM, "Jeyapal, Karthick"  wrote:
> 
>>> On 11/22/17, 9:32 AM, "刘歧"  wrote:
>>> 
>>> This patch is ok, but i see it need an API: ffio_geturlcontext
>>> 
>>> it in the other patch, i see it have some thing need talk? If that is ok, 
>>> this patch should be apply.
Is this ok?

Thanks
>> Thanks for the reply. 
>> All concerns raised by Nicolas has been addressed in this latest patch set.
>> Let us wait for few days to check if anyone still has any objections.
> Looks like nobody has anymore objections to this patchset. 
> Well, it has already passed through multiple rounds of reviews.
> Could somebody please push this to the master. 
> I have few more patches waiting to be submitted, dependent on this feature.
>>> 
>>> Thanks
> 
> regards,
> Karthick
> 
> 
> 
> ___
> 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/hlsenc: Added context to av_log calls

2017-11-24 Thread Karthick J
---
 libavformat/hlsenc.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 30ccf73..379a4ec 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1057,7 +1057,6 @@ static int get_relative_url(const char *master_url, const 
char *media_url,
 if (p) {
 base_len = FFABS(p - master_url);
 if (av_strncasecmp(master_url, media_url, base_len)) {
-av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
 return AVERROR(EINVAL);
 }
 }
@@ -1096,7 +1095,7 @@ static int create_master_playlist(AVFormatContext *s,
  &options);
 av_dict_free(&options);
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Failed to open master play list file 
'%s'\n",
+av_log(s, AV_LOG_ERROR, "Failed to open master play list file '%s'\n",
 hls->master_m3u8_url);
 goto fail;
 }
@@ -1118,7 +1117,7 @@ static int create_master_playlist(AVFormatContext *s,
 ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
m3u8_rel_name, m3u8_name_size);
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
+av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
 goto fail;
 }
 
@@ -1132,7 +1131,7 @@ static int create_master_playlist(AVFormatContext *s,
 }
 
 if (!vid_st && !aud_st) {
-av_log(NULL, AV_LOG_WARNING, "Media stream not found\n");
+av_log(s, AV_LOG_WARNING, "Media stream not found\n");
 continue;
 }
 
@@ -1144,7 +1143,7 @@ static int create_master_playlist(AVFormatContext *s,
 bandwidth += bandwidth / 10;
 
 if (!bandwidth) {
-av_log(NULL, AV_LOG_WARNING,
+av_log(s, AV_LOG_WARNING,
 "Bandwidth info not available, set audio and video 
bitrates\n");
 av_freep(&m3u8_rel_name);
 continue;
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread 刘歧

> 在 2017年11月24日,18:12,Karthick J  写道:
> 
> ---
> libavformat/hlsenc.c | 9 -
> 1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 30ccf73..379a4ec 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1057,7 +1057,6 @@ static int get_relative_url(const char *master_url, 
> const char *media_url,
> if (p) {
> base_len = FFABS(p - master_url);
> if (av_strncasecmp(master_url, media_url, base_len)) {
> -av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
> return AVERROR(EINVAL);
> }
> }
> @@ -1096,7 +1095,7 @@ static int create_master_playlist(AVFormatContext *s,
>  &options);
> av_dict_free(&options);
> if (ret < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Failed to open master play list file 
> '%s'\n",
> +av_log(s, AV_LOG_ERROR, "Failed to open master play list file 
> '%s'\n",
> hls->master_m3u8_url);
> goto fail;
> }
> @@ -1118,7 +1117,7 @@ static int create_master_playlist(AVFormatContext *s,
> ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
>m3u8_rel_name, m3u8_name_size);
> if (ret < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
> +av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
> goto fail;
> }
> 
> @@ -1132,7 +1131,7 @@ static int create_master_playlist(AVFormatContext *s,
> }
> 
> if (!vid_st && !aud_st) {
> -av_log(NULL, AV_LOG_WARNING, "Media stream not found\n");
> +av_log(s, AV_LOG_WARNING, "Media stream not found\n");
> continue;
> }
> 
> @@ -1144,7 +1143,7 @@ static int create_master_playlist(AVFormatContext *s,
> bandwidth += bandwidth / 10;
> 
> if (!bandwidth) {
> -av_log(NULL, AV_LOG_WARNING,
> +av_log(s, AV_LOG_WARNING,
> "Bandwidth info not available, set audio and video 
> bitrates\n");
> av_freep(&m3u8_rel_name);
> continue;
> -- 
> 1.9.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM


Thanks

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


Re: [FFmpeg-devel] [PATCH v2 3/3] libavformat/hlsenc: Persistent HTTP connections supported as an option

2017-11-24 Thread Jeyapal, Karthick
On 11/24/17, 3:40 PM, "刘歧"  wrote:

>> 在 2017年11月24日,18:02,Jeyapal, Karthick  写道:
>> 
>> On 11/22/17, 1:27 PM, "Jeyapal, Karthick"  wrote:
>> 
 On 11/22/17, 9:32 AM, "刘歧"  wrote:
 
 This patch is ok, but i see it need an API: ffio_geturlcontext
 
 it in the other patch, i see it have some thing need talk? If that is ok, 
 this patch should be apply.
>Is this ok?
Yes, ffio_geturlcontext has already been accepted by Nicolas.
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220014.html
He had concerns on calling prot->url_write directly from hlsenc, which has been 
removed on new patchset(v2).
Also av_assert0 has been added as suggested by him
>
>Thanks
>>> Thanks for the reply. 
>>> All concerns raised by Nicolas has been addressed in this latest patch set.
>>> Let us wait for few days to check if anyone still has any objections.
>> Looks like nobody has anymore objections to this patchset. 
>> Well, it has already passed through multiple rounds of reviews.
>> Could somebody please push this to the master. 
>> I have few more patches waiting to be submitted, dependent on this feature.

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


Re: [FFmpeg-devel] Adding option B does not work

2017-11-24 Thread Moritz Barsnick
On Thu, Nov 23, 2017 at 14:41:45 +, shailender Jain wrote:
> I am trying to ensure that a specific number of B Frames should be
> used by FFMPEG. I am running the following command

This list is solely for the discussion of the development of ffmpeg and
libav*.

For usage questions, please refer to the list ffmpeg-user.

> However, when i look at the stats.txt, i cannot see 16 B-Frames. Is
> there any way this can be done? I want to find a way by which i can
> enforce if a frame will be B-Frame or P-Frame or I-Frame. Is this
> feasible? If not, then please help me identify the source code where
> i can update the code

"-bf" only specifies the *maximum* number of B-frames. The encoder - in
this case x264 - makes its own decisions, and will rarely choose 16.
You can influence x264's decisions by using some of its special
options, and passing them via ffmpeg's "-x264opts". See here (and
slightly below) for a lot of options which *may* actually make x264
create 16 B-frames:
http://www.chaneru.com/Roku/HLS/X264_Settings.htm#bframes

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


Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Mark Thompson
On 24/11/17 09:37, Karthick J wrote:
> From: Vishwanath Dixit 
> 
> ---
>  libavcodec/libx264.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index 9c67c91..6b93aa8 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -454,6 +454,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
>  X264Context *x4 = avctx->priv_data;
>  AVCPBProperties *cpb_props;
>  int sw,sh;
> +x264_nal_t *nal;
> +uint8_t *p;
> +int nnal, s, i;
>  
>  if (avctx->global_quality > 0)
>  av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is 
> recommended.\n");
> @@ -799,12 +802,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (!x4->enc)
>  return AVERROR_EXTERNAL;
>  
> -if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> -x264_nal_t *nal;
> -uint8_t *p;
> -int nnal, s, i;
> +s = x264_encoder_headers(x4->enc, &nal, &nnal);
> +avctx->profile = nal->p_payload[5];

AVCodecContext.profile should include some of the constraint_set_flags - see 
.

> +avctx->level = nal->p_payload[7];

I don't much like the hard-coding of the offsets here.  Maybe add some asserts 
so that it fails very quickly if something ever changes?  (I don't think it 
will with libx264, but if it does then this is going to be putting nonsense in 
the metadata.)

>  
> -s = x264_encoder_headers(x4->enc, &nal, &nnal);
> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>  avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!p)
>  return AVERROR(ENOMEM);
> 

I think I preferred the version which only wrote the value if it isn't already 
set.  If the user specifies a profile then it should use that or fail.

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread Moritz Barsnick
On Fri, Nov 24, 2017 at 15:42:30 +0530, Karthick J wrote:
>  if (av_strncasecmp(master_url, media_url, base_len)) {
> -av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
>  return AVERROR(EINVAL);

Was it intention to remove this one?

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


Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 11:55 GMT+01:00 Mark Thompson :
> On 24/11/17 09:37, Karthick J wrote:

>> -s = x264_encoder_headers(x4->enc, &nal, &nnal);
>> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>>  avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!p)
>>  return AVERROR(ENOMEM);
>>
>
> I think I preferred the version which only wrote the value
> if it isn't already set.  If the user specifies a profile then
> it should use that or fail.

The only way to let the user know that another profile was
used (and to fail) is to set the value unconditionally here.

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 12:03 GMT+01:00 Moritz Barsnick :
> On Fri, Nov 24, 2017 at 15:42:30 +0530, Karthick J wrote:
>>  if (av_strncasecmp(master_url, media_url, base_len)) {
>> -av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
>>  return AVERROR(EINVAL);
>
> Was it intention to remove this one?

If yes, please mention in the commit message that this was
not a useful warning (or make it a separate commit).

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Carl Eugen Hoyos
2017-11-23 4:37 GMT+01:00  :
> From: Vishwanath Dixit 

> +// either provide codec string for both active streams or for none
> +if (vid_st && aud_st && (!strlen(vcodec) || !strlen(acodec))) {
> +acodec[0] = vcodec[0] = '\0';
> +av_log(NULL, AV_LOG_INFO, "Codec string not available for audio or 
> video stream\n");

What happened to this check?

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


Re: [FFmpeg-devel] [PATCH]lavc/avcodec: Allow libavcodec to overwrite profile and level

2017-11-24 Thread Mark Thompson
On 24/11/17 02:54, Jeyapal, Karthick wrote:
> 
> 
> On 11/24/17, 5:17 AM, "Carl Eugen Hoyos"  wrote:
> 
>> 2017-11-23 22:58 GMT+01:00 Michael Niedermayer :
>>> On Thu, Nov 23, 2017 at 04:01:06PM +0100, Carl Eugen Hoyos wrote:
 Hi!

 The (external) encoders may overwrite level and profile because of
 requested encoding properties, allowing libavcodec to (also) overwrite
 them in the context makes sense (and is already done in some cases
 afaict).

 Please comment, Carl Eugen
>>>
>>> If a user needs to generate a file with a specific profile/level
>>> for example because its for broadcast, some specification or a hw
>>> decoder.
>>> How could he after this patch ensure that exactly the needed profile
>>> is used?
> There is no way of ensuring the same even without this patch.
> 
>> Afair, x264 does change profile and / or level depending on properties
>> set by the user. Currently there is no way for the libavcodec user to
>> know that libx264 changed something.
>> With this change the user can know that he does not get the
>> requested values.
>>
>> Or am I wrong and libx264 never overwrites requested values
>> for level and / or profile?
>>
> 
> I just tested x264 by giving contradicting profiles and levels. 
> Following are the results:
> Case 1:
> Input : 1080p30, 420p
> Config : Set level wrongly to 1.1
> Output : Throws some warnings, but level is still written wrongly as 1.1 is 
> the SPS header.
> Impact of overwrite : None. Both the user set value and header’s value are 
> same.
> 
> Case 2:1080p30, 422p
> Config : Set profile wrongly to baseline
> Output : Throws errors, doesn’t encode
> Impact of overwrite : None. 
> 
> Case 3:1080p30, 420p
> Config : Set profile wrongly to high422

That's not wrong.  High 4:2:2 profile admits bit_depth_*_minus8 == 0 and 
chroma_format_idc == 1.

> Output : No warnings or errors. Automatically switches to high profile. SPS 
> header also has high profile.

That feels like ffmpeg and libx264 aren't quite agreeing about what the profile 
field should mean.  libx264 is using it as an extra set of constraints and then 
picking a profile conforming to everything specified later, whereas the usual 
ffmpeg use is to apply that specific setting.  The libx264-in-ffmpeg 
documentation does admittedly say "Set profile restrictions." kindof suggesting 
that use, but it is still at odds with most other encoders.

> Impact of overwrite : User will get to know the correct profile being encoded.

I don't like this overwrite, but I'm not sure what a better answer is.

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


Re: [FFmpeg-devel] [PATCH 14/17] mjpegdec: Add hwaccel hooks

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 1:51 GMT+01:00 Mark Thompson :
> Also adds some extra fields to the main context structure
> that may be needed by a hwaccel decoder.
> ---
> The YUVJ formats really mess with this.  This patch hacks
> them out so that the hwaccel works, suggestions welcome
> on what to actually do about them.

> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ420P)
> +s->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ422P)
> +s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;

The hardware decoders output mpeg-scaled frames?

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


Re: [FFmpeg-devel] [PATCH 14/17] mjpegdec: Add hwaccel hooks

2017-11-24 Thread Mark Thompson
On 24/11/17 07:25, Jun Zhao wrote:
> 
> 
> On 2017/11/24 8:51, Mark Thompson wrote:
>> Also adds some extra fields to the main context structure that may
>> be needed by a hwaccel decoder.
>> ---
>> The YUVJ formats really mess with this.  This patch hacks them out so that 
>> the hwaccel works, suggestions welcome on what to actually do about them.
>>
>>
>>  libavcodec/mjpegdec.c | 70 
>> +--
>>  libavcodec/mjpegdec.h | 11 
>>  2 files changed, 79 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
>> index f01d44a169..846dec2f42 100644
>> --- a/libavcodec/mjpegdec.c
>> +++ b/libavcodec/mjpegdec.c
>> @@ -36,6 +36,7 @@
>>  #include "avcodec.h"
>>  #include "blockdsp.h"
>>  #include "copy_block.h"
>> +#include "hwaccel.h"
>>  #include "idctdsp.h"
>>  #include "internal.h"
>>  #include "jpegtables.h"
>> @@ -147,6 +148,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
>>  s->org_height= avctx->coded_height;
>>  avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
>>  avctx->colorspace = AVCOL_SPC_BT470BG;
>> +s->hwaccel_pix_fmt = s->hwaccel_sw_pix_fmt = AV_PIX_FMT_NONE;
>>  
>>  if ((ret = build_basic_mjpeg_vlc(s)) < 0)
>>  return ret;
>> @@ -279,6 +281,11 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
>>   code_max + 1, 0, 0)) < 0)
>>  return ret;
>>  }
>> +
>> +for (i = 0; i < 16; i++)
>> +s->raw_huffman_lengths[class][index][i] = bits_table[i + 1];
>> +for (i = 0; i < 256; i++)
>> +s->raw_huffman_values[class][index][i] = val_table[i];
>>  }
>>  return 0;
>>  }
>> @@ -636,6 +643,26 @@ unk_pixfmt:
>>  return AVERROR_BUG;
>>  }
>>  
>> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ420P)
>> +s->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
>> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ422P)
>> +s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
>> +
> Maybe need to give a comments in the code for this workaround, not just
> in the commit message.

This hack is not intended to be applied.  The note above after the commit 
message is inviting comment on what to actually do.

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


Re: [FFmpeg-devel] [PATCH 2/2 v2] avformat/flacenc: add flac_init() and flac_deinit()

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 4:38 GMT+01:00 James Almer :
> Signed-off-by: James Almer 
> ---
> Simpler/smaller diff.

Sorry if this is obvious:
What is the advantage of having these new functions?

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Jeyapal, Karthick


On 11/24/17, 4:41 PM, "Carl Eugen Hoyos"  wrote:

>2017-11-23 4:37 GMT+01:00  :
>> From: Vishwanath Dixit 

>> +// either provide codec string for both active streams or for none
>> +if (vid_st && aud_st && (!strlen(vcodec) || !strlen(acodec))) {
>> +acodec[0] = vcodec[0] = '\0';
>> +av_log(NULL, AV_LOG_INFO, "Codec string not available for audio or 
>> video stream\n");
>
>What happened to this check?

It has been handled indirectly in the new function.
In the new function will hit the else condition and “goto fail”
+} else {
+goto fail;
+}

regards,
Karthick

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread 刘歧

> 在 2017年11月24日,19:03,Moritz Barsnick  写道:
> 
> On Fri, Nov 24, 2017 at 15:42:30 +0530, Karthick J wrote:
>> if (av_strncasecmp(master_url, media_url, base_len)) {
>> -av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
>> return AVERROR(EINVAL);
> 
> Was it intention to remove this one?
I think yes, because he move the av_log out of this call.
> 
> Moritz
> ___
> 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 14/17] mjpegdec: Add hwaccel hooks

2017-11-24 Thread Mark Thompson
On 24/11/17 11:17, Carl Eugen Hoyos wrote:
> 2017-11-24 1:51 GMT+01:00 Mark Thompson :
>> Also adds some extra fields to the main context structure
>> that may be needed by a hwaccel decoder.
>> ---
>> The YUVJ formats really mess with this.  This patch hacks
>> them out so that the hwaccel works, suggestions welcome
>> on what to actually do about them.
> 
>> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ420P)
>> +s->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
>> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ422P)
>> +s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
> 
> The hardware decoders output mpeg-scaled frames?

I think some do, though I haven't seen it myself.  Those that don't (like 
VAAPI) will use the color_range metadata - I think don't it is sensible to add 
lots of extra paths to support YUVJ formats in AVHWFramesContext.sw_format.

Thanks,

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


Re: [FFmpeg-devel] [PATCH 13/17] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 1:51 GMT+01:00 Mark Thompson :
> This is needed by later hwaccel code to tell which encoding process was
> used for a particular frame, because hardware decoders may only support a
> subset of possible methods.
> ---
>  libavcodec/avcodec.h  | 6 ++
>  libavcodec/mjpegdec.c | 7 +++
>  2 files changed, 13 insertions(+)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0972df0bde..c1e68b1d13 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2897,6 +2897,12 @@ typedef struct AVCodecContext {
>  #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE  3
>  #define FF_PROFILE_HEVC_REXT4
>
> +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0
> +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
> +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
> +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3
> +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7

Sorry if I misread the code:
If you (thankfully) define these as in the specification, why don't you
simply set them without the "if()"'s?

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


[FFmpeg-devel] [PATCH v2] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread Karthick J
Also removed a redundant av_log call
---
 libavformat/hlsenc.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 30ccf73..379a4ec 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1057,7 +1057,6 @@ static int get_relative_url(const char *master_url, const 
char *media_url,
 if (p) {
 base_len = FFABS(p - master_url);
 if (av_strncasecmp(master_url, media_url, base_len)) {
-av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
 return AVERROR(EINVAL);
 }
 }
@@ -1096,7 +1095,7 @@ static int create_master_playlist(AVFormatContext *s,
  &options);
 av_dict_free(&options);
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Failed to open master play list file 
'%s'\n",
+av_log(s, AV_LOG_ERROR, "Failed to open master play list file '%s'\n",
 hls->master_m3u8_url);
 goto fail;
 }
@@ -1118,7 +1117,7 @@ static int create_master_playlist(AVFormatContext *s,
 ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
m3u8_rel_name, m3u8_name_size);
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
+av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
 goto fail;
 }
 
@@ -1132,7 +1131,7 @@ static int create_master_playlist(AVFormatContext *s,
 }
 
 if (!vid_st && !aud_st) {
-av_log(NULL, AV_LOG_WARNING, "Media stream not found\n");
+av_log(s, AV_LOG_WARNING, "Media stream not found\n");
 continue;
 }
 
@@ -1144,7 +1143,7 @@ static int create_master_playlist(AVFormatContext *s,
 bandwidth += bandwidth / 10;
 
 if (!bandwidth) {
-av_log(NULL, AV_LOG_WARNING,
+av_log(s, AV_LOG_WARNING,
 "Bandwidth info not available, set audio and video 
bitrates\n");
 av_freep(&m3u8_rel_name);
 continue;
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 1:51 GMT+01:00 Mark Thompson :

> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 1ae0344bb2..0972df0bde 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
>   * - encoding: unused.
>   * - decoding: Set by libavcodec
>   */
> -struct AVHWAccel *hwaccel;
> +const struct AVHWAccel *hwaccel;

Please bump minor (and perhaps add a note for api), iirc
this has an impact for some toolchains, no?

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Added context to av_log calls

2017-11-24 Thread Jeyapal, Karthick


On 11/24/17, 4:36 PM, "Carl Eugen Hoyos"  wrote:

>2017-11-24 12:03 GMT+01:00 Moritz Barsnick :
>> On Fri, Nov 24, 2017 at 15:42:30 +0530, Karthick J wrote:
>>>  if (av_strncasecmp(master_url, media_url, base_len)) {
>>> -av_log(NULL, AV_LOG_WARNING, "Unable to find relative url\n");
>>>  return AVERROR(EINVAL);
>>
>> Was it intention to remove this one?
Thanks for that question.
Yes, it was removed intentionally, as the calling function was also printing 
the same log, with ERROR.
>
>If yes, please mention in the commit message that this was
>not a useful warning (or make it a separate commit).
I have amended the commit message and have sent a new patch v2.

Thanks and regards,
Karthick



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


Re: [FFmpeg-devel] [PATCH 13/17] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

2017-11-24 Thread Mark Thompson
On 24/11/17 11:27, Carl Eugen Hoyos wrote:
> 2017-11-24 1:51 GMT+01:00 Mark Thompson :
>> This is needed by later hwaccel code to tell which encoding process was
>> used for a particular frame, because hardware decoders may only support a
>> subset of possible methods.
>> ---
>>  libavcodec/avcodec.h  | 6 ++
>>  libavcodec/mjpegdec.c | 7 +++
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 0972df0bde..c1e68b1d13 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -2897,6 +2897,12 @@ typedef struct AVCodecContext {
>>  #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE  3
>>  #define FF_PROFILE_HEVC_REXT4
>>
>> +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0
>> +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
>> +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
>> +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3
>> +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
> 
> Sorry if I misread the code:
> If you (thankfully) define these as in the specification, why don't you
> simply set them without the "if()"'s?

They have to be set inside the switch because there are other non-SOF markers 
there.

In each case they could then be set from start_code, but it seemed clearer to 
write the profile out properly?

I can change it to use start_code directly if you prefer.

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


Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const

2017-11-24 Thread Mark Thompson
On 24/11/17 11:29, Carl Eugen Hoyos wrote:
> 2017-11-24 1:51 GMT+01:00 Mark Thompson :
> 
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 1ae0344bb2..0972df0bde 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
>>   * - encoding: unused.
>>   * - decoding: Set by libavcodec
>>   */
>> -struct AVHWAccel *hwaccel;
>> +const struct AVHWAccel *hwaccel;
> 
> Please bump minor (and perhaps add a note for api),

Sure.

"""
2017-xx-xx - xxx - lavc 58.x+1.100 - avcodec.h
  Add const to AVCodecContext.hwaccel.
"""

> iirc this has an impact for some toolchains, no?

I don't think so?  C requires that const-qualified and unqualified versions of 
a type have the same representation.  Adding const could affect C++ name 
mangling, but we don't support building directly with C++ ("extern \"C\"" is 
needed).

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


Re: [FFmpeg-devel] [PATCH 13/17] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 12:35 GMT+01:00 Mark Thompson :
> On 24/11/17 11:27, Carl Eugen Hoyos wrote:
>> 2017-11-24 1:51 GMT+01:00 Mark Thompson :
>>> This is needed by later hwaccel code to tell which encoding process was
>>> used for a particular frame, because hardware decoders may only support a
>>> subset of possible methods.
>>> ---
>>>  libavcodec/avcodec.h  | 6 ++
>>>  libavcodec/mjpegdec.c | 7 +++
>>>  2 files changed, 13 insertions(+)
>>>
>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>> index 0972df0bde..c1e68b1d13 100644
>>> --- a/libavcodec/avcodec.h
>>> +++ b/libavcodec/avcodec.h
>>> @@ -2897,6 +2897,12 @@ typedef struct AVCodecContext {
>>>  #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE  3
>>>  #define FF_PROFILE_HEVC_REXT4
>>>
>>> +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0
>>> +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
>>> +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
>>> +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3
>>> +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
>>
>> Sorry if I misread the code:
>> If you (thankfully) define these as in the specification, why don't you
>> simply set them without the "if()"'s?
>
> They have to be set inside the switch because there are
> other non-SOF markers there.

Of course, thank you!

> In each case they could then be set from start_code, but it
> seemed clearer to write the profile out properly?

See other thread: What is unreadable to one developer
is clearer to another;-)

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


Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 12:42 GMT+01:00 Mark Thompson :
> On 24/11/17 11:29, Carl Eugen Hoyos wrote:
>> 2017-11-24 1:51 GMT+01:00 Mark Thompson :
>>
>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>> index 1ae0344bb2..0972df0bde 100644
>>> --- a/libavcodec/avcodec.h
>>> +++ b/libavcodec/avcodec.h
>>> @@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
>>>   * - encoding: unused.
>>>   * - decoding: Set by libavcodec
>>>   */
>>> -struct AVHWAccel *hwaccel;
>>> +const struct AVHWAccel *hwaccel;
>>
>> Please bump minor (and perhaps add a note for api),
>
> Sure.
>
> """
> 2017-xx-xx - xxx - lavc 58.x+1.100 - avcodec.h
>   Add const to AVCodecContext.hwaccel.
> """
>
>> iirc this has an impact for some toolchains, no?
>
> I don't think so?  C requires that const-qualified and
> unqualified versions of a type have the same representation.

> Adding const could affect C++ name mangling, but we don't
> support building directly with C++ ("extern \"C\"" is needed).

I thought that this is an issue, but I may misremember.

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


Re: [FFmpeg-devel] [PATCH]lavf/matroskaenc: Do not write 0 duration for subtitles

2017-11-24 Thread Jerome Martinez

On 23/11/2017 20:02, John Stebbins wrote:

[...] It's not practical to
know the duration of the previous subtitle before writing it because you can't 
know it till you have seen this empty
PGS.  Once you've seen the empty PGS, it is often too late to properly 
interleave the previous PGS in the output file.


I argued that on CELLAR mailing list (this is especially true in the 
case of live streaming) but did not find consensus about the need to 
have a different semantic for "clear" compared to "display empty 
subtitle", so for "clear" you have to use "display empty subtitle" thing 
as a workaround. It may change in the future.




Your suggestion (0 means up to next frame) however works I believe.  I.e. display the 
"empty" PGS up to the next frame.


Right. I actually don't change the code in the patch, just the reason.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavu/pixfmt: Remove gap in the middle of enum AVPixelFormat

2017-11-24 Thread Mark Thompson
This was added for compatibility with libav, by leaving a space for
formats added in libav to be merged.  Since that feature has been
removed, we don't need a gap here.
---
Should be applied before the unstable ABI period ends.


 libavutil/pixfmt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 4c530fe..e184a56 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -230,7 +230,7 @@ enum AVPixelFormat {
  */
 AV_PIX_FMT_CUDA,
 
-AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   
X=unused/undefined
+AV_PIX_FMT_0RGB,///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   
X=unused/undefined
 AV_PIX_FMT_RGB0,///< packed RGB 8:8:8, 32bpp, RGBXRGBX...   
X=unused/undefined
 AV_PIX_FMT_0BGR,///< packed BGR 8:8:8, 32bpp, XBGRXBGR...   
X=unused/undefined
 AV_PIX_FMT_BGR0,///< packed BGR 8:8:8, 32bpp, BGRXBGRX...   
X=unused/undefined
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add mix filter

2017-11-24 Thread Paul B Mahol
On 11/20/17, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |  28 +
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/vf_mix.c | 283
> +++
>  4 files changed, 313 insertions(+)
>  create mode 100644 libavfilter/vf_mix.c
>

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


Re: [FFmpeg-devel] [PATCH 16/17] hwcontext_vaapi: Move better-matching surface formats earlier

2017-11-24 Thread Mark Thompson
On 24/11/17 08:28, Jun Zhao wrote:
> On 2017/11/24 8:51, Mark Thompson wrote:
>> In particular, avoid selecting YV12/YV16 when I420/422H are available.
>> ---
>>  libavutil/hwcontext_vaapi.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
>> index fcff25dc9b..2f47162a0d 100644
>> --- a/libavutil/hwcontext_vaapi.c
>> +++ b/libavutil/hwcontext_vaapi.c
>> @@ -99,15 +99,15 @@ static const struct {
>>  enum AVPixelFormat pix_fmt;
>>  } vaapi_format_map[] = {
>>  MAP(NV12, YUV420,  NV12),
>> -MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>> -MAP(IYUV, YUV420,  YUV420P),
>>  #ifdef VA_FOURCC_I420
>>  MAP(I420, YUV420,  YUV420P),
>>  #endif
>> +MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>> +MAP(IYUV, YUV420,  YUV420P),
>> +MAP(422H, YUV422,  YUV422P),
> Can we give a flag or other field to identify the map priority, not use
> the hard code array index order ?

Well, really we need to add some way to control the layout for formats which 
are identical from the point of view of the CPU (that is, have the same enum 
AVPixelFormat).  The 4:2:2 cases make at least a little bit of sense like this, 
but more is definitely needed to distinguish all the IMC* formats for YUV420P.  
A priority wouldn't change that.

(This is primarily intended as a simple hack to make 4:2:2 MJPEG decode work on 
Intel - it needs to choose 422H rather than YV16 for YUV422P.)

>>  #ifdef VA_FOURCC_YV16
>>  MAP(YV16, YUV422,  YUV422P), // With U/V planes swapped.
>>  #endif
>> -MAP(422H, YUV422,  YUV422P),
>>  MAP(UYVY, YUV422,  UYVY422),
>>  MAP(YUY2, YUV422,  YUYV422),
>>  MAP(Y800, YUV400,  GRAY8),
> 

Thanks,

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


Re: [FFmpeg-devel] [PATCH 16/17] hwcontext_vaapi: Move better-matching surface formats earlier

2017-11-24 Thread Carl Eugen Hoyos
2017-11-24 14:06 GMT+01:00 Mark Thompson :
> On 24/11/17 08:28, Jun Zhao wrote:
>> On 2017/11/24 8:51, Mark Thompson wrote:
>>> In particular, avoid selecting YV12/YV16 when I420/422H are available.
>>> ---
>>>  libavutil/hwcontext_vaapi.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
>>> index fcff25dc9b..2f47162a0d 100644
>>> --- a/libavutil/hwcontext_vaapi.c
>>> +++ b/libavutil/hwcontext_vaapi.c
>>> @@ -99,15 +99,15 @@ static const struct {
>>>  enum AVPixelFormat pix_fmt;
>>>  } vaapi_format_map[] = {
>>>  MAP(NV12, YUV420,  NV12),
>>> -MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>>> -MAP(IYUV, YUV420,  YUV420P),
>>>  #ifdef VA_FOURCC_I420
>>>  MAP(I420, YUV420,  YUV420P),
>>>  #endif
>>> +MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>>> +MAP(IYUV, YUV420,  YUV420P),
>>> +MAP(422H, YUV422,  YUV422P),
>> Can we give a flag or other field to identify the map priority, not use
>> the hard code array index order ?
>
> Well, really we need to add some way to control the layout for formats
> which are identical from the point of view of the CPU (that is, have the
> same enum AVPixelFormat).

Is it not enough to set the codec_tag?

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


Re: [FFmpeg-devel] [PATCH 2/2 v2] avformat/flacenc: add flac_init() and flac_deinit()

2017-11-24 Thread James Almer
On 11/24/2017 8:19 AM, Carl Eugen Hoyos wrote:
> 2017-11-24 4:38 GMT+01:00 James Almer :
>> Signed-off-by: James Almer 
>> ---
>> Simpler/smaller diff.
> 
> Sorry if this is obvious:
> What is the advantage of having these new functions?
> 
> Carl Eugen

Muxers with an init() function can be initialized before the header is
written. deinit() is mainly meant to free any allocated buffer in init()
in case the latter fails, but should ideally also be used to free what
would otherwise be freed in write_trailer().
API users can know if muxing is possible and in some cases have the
output streams initialized with container specific parameters by calling
avformat_init_output() before avformat_write_header() with the above
functions.

ffmpeg.c should ideally be doing the above, so we can remove all the
delayed header writing code in libavformat/mux.c (see the patch i sent
for the latter some time ago).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] udp: Check the port number provided by av_url_split as per docs

2017-11-24 Thread Derek Buitenhuis
On 11/23/2017 11:28 PM, Michael Niedermayer wrote:
> this seems to break rtp / rtsp
> 
> ive traced it to
> ff_rtsp_make_setup_request() calling ffurl_open_whitelist() without
> a port

Looking at:


https://github.com/FFmpeg/FFmpeg/blob/1e27837265702b63db65122e97178a0ca4d25e05/libavformat/rtsp.c#L1466-L1476

It seems it's using '?localport=' instead of specifying a port...

Is there a particular reason for this? It seems... odd. I don't know the RTSP
code, really.

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


Re: [FFmpeg-devel] [PATCH] avfilter/af_amix: add double sample format support

2017-11-24 Thread Carl Eugen Hoyos
2017-04-09 22:11 GMT+02:00 Paul B Mahol :
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/af_amix.c | 19 +++
>  libavutil/float_dsp.c |  9 +
>  libavutil/float_dsp.h | 16 

The change to libavutil broke ABI, see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882598

I will open a ticket, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavcodec/libx264.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91..2f7f53c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/eval.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
@@ -454,6 +455,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
 X264Context *x4 = avctx->priv_data;
 AVCPBProperties *cpb_props;
 int sw,sh;
+x264_nal_t *nal;
+uint8_t *p;
+int nnal, s, i;
 
 if (avctx->global_quality > 0)
 av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is 
recommended.\n");
@@ -799,12 +803,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!x4->enc)
 return AVERROR_EXTERNAL;
 
-if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
-x264_nal_t *nal;
-uint8_t *p;
-int nnal, s, i;
+s = x264_encoder_headers(x4->enc, &nal, &nnal);
+// Assert for NAL start code and SPS unit type
+av_assert0((nal->p_payload[0] | nal->p_payload[1] | nal->p_payload[2]) == 
0 && nal->p_payload[3] == 1);
+av_assert0((nal->p_payload[4] & 0x1F) == 7);
+// bits 0-7 LSB for profile. bits 8-11 for constrained set flags.
+avctx->profile = ((uint32_t)nal->p_payload[5]) | 
(((uint32_t)nal->p_payload[6] >> 4) << 8);
+avctx->level = nal->p_payload[7];
 
-s = x264_encoder_headers(x4->enc, &nal, &nnal);
+if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!p)
 return AVERROR(ENOMEM);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH v3 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavformat/hlsenc.c | 66 +++-
 1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 58d7c58..92c90a1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1066,6 +1066,63 @@ static int get_relative_url(const char *master_url, 
const char *media_url,
 return 0;
 }
 
+static char *get_codec_str(AVStream *vid_st, AVStream *aud_st) {
+size_t codec_str_size = 64;
+char *codec_str = av_malloc(codec_str_size);
+int video_str_len = 0;
+
+if (!codec_str)
+return NULL;
+
+if (!vid_st && !aud_st) {
+goto fail;
+}
+
+if (vid_st) {
+if (vid_st->codecpar->profile != FF_PROFILE_UNKNOWN &&
+vid_st->codecpar->level != FF_LEVEL_UNKNOWN &&
+vid_st->codecpar->codec_id == AV_CODEC_ID_H264) {
+snprintf(codec_str, codec_str_size, "avc1.%02x%02x%02x",
+ vid_st->codecpar->profile & 0xFF,
+ ((vid_st->codecpar->profile >> 8) << 4) & 0xFF,
+ vid_st->codecpar->level);
+} else {
+goto fail;
+}
+video_str_len = strlen(codec_str);
+}
+
+if (aud_st) {
+char *audio_str = codec_str;
+if (video_str_len) {
+codec_str[video_str_len] = ',';
+video_str_len += 1;
+audio_str += video_str_len;
+codec_str_size -= video_str_len;
+}
+if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP2) {
+snprintf(audio_str, codec_str_size, "mp4a.40.33");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP3) {
+snprintf(audio_str, codec_str_size, "mp4a.40.34");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AAC) {
+/* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 
5 and 29 respectively */
+snprintf(audio_str, codec_str_size, "mp4a.40.2");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A5");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A6");
+} else {
+goto fail;
+}
+}
+
+return codec_str;
+
+fail:
+av_free(codec_str);
+return NULL;
+}
+
 static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
@@ -1076,7 +1133,7 @@ static int create_master_playlist(AVFormatContext *s,
 AVDictionary *options = NULL;
 unsigned int i, j;
 int m3u8_name_size, ret, bandwidth;
-char *m3u8_rel_name;
+char *m3u8_rel_name, *codec_str;
 
 input_vs->m3u8_created = 1;
 if (!hls->master_m3u8_created) {
@@ -1203,6 +1260,13 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
 
+codec_str = get_codec_str(vid_st, aud_st);
+
+if (codec_str) {
+avio_printf(master_pb, ",CODECS=\"%s\"", codec_str);
+av_free(codec_str);
+}
+
 if (vs->agroup && aud_st)
 avio_printf(master_pb, ",AUDIO=\"group_%s\"", vs->agroup);
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH v4 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavcodec/libx264.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91..545826c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -19,11 +19,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/eval.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/reverse.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
@@ -454,6 +456,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
 X264Context *x4 = avctx->priv_data;
 AVCPBProperties *cpb_props;
 int sw,sh;
+x264_nal_t *nal;
+uint8_t *p;
+int nnal, s, i;
 
 if (avctx->global_quality > 0)
 av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is 
recommended.\n");
@@ -799,12 +804,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!x4->enc)
 return AVERROR_EXTERNAL;
 
-if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
-x264_nal_t *nal;
-uint8_t *p;
-int nnal, s, i;
+s = x264_encoder_headers(x4->enc, &nal, &nnal);
+// Assert for NAL start code and SPS unit type
+av_assert0((nal->p_payload[0] | nal->p_payload[1] | nal->p_payload[2]) == 
0 && nal->p_payload[3] == 1);
+av_assert0((nal->p_payload[4] & 0x1F) == 7);
+// bits 0-7 LSB for profile. bits 8-11 for constrained set flags.
+avctx->profile = ((uint32_t)nal->p_payload[5]) | 
((uint32_t)ff_reverse[nal->p_payload[6]] << 8);
+avctx->level = nal->p_payload[7];
 
-s = x264_encoder_headers(x4->enc, &nal, &nnal);
+if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!p)
 return AVERROR(ENOMEM);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH v4 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-24 Thread Karthick J
From: Vishwanath Dixit 

---
 libavformat/hlsenc.c | 67 +++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 58d7c58..d48963c 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/random_seed.h"
+#include "libavutil/reverse.h"
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 #include "libavutil/time_internal.h"
@@ -1066,6 +1067,63 @@ static int get_relative_url(const char *master_url, 
const char *media_url,
 return 0;
 }
 
+static char *get_codec_str(AVStream *vid_st, AVStream *aud_st) {
+size_t codec_str_size = 64;
+char *codec_str = av_malloc(codec_str_size);
+int video_str_len = 0;
+
+if (!codec_str)
+return NULL;
+
+if (!vid_st && !aud_st) {
+goto fail;
+}
+
+if (vid_st) {
+if (vid_st->codecpar->profile != FF_PROFILE_UNKNOWN &&
+vid_st->codecpar->level != FF_LEVEL_UNKNOWN &&
+vid_st->codecpar->codec_id == AV_CODEC_ID_H264) {
+snprintf(codec_str, codec_str_size, "avc1.%02x%02x%02x",
+ vid_st->codecpar->profile & 0xFF,
+ ff_reverse[(vid_st->codecpar->profile >> 8) & 0xFF],
+ vid_st->codecpar->level);
+} else {
+goto fail;
+}
+video_str_len = strlen(codec_str);
+}
+
+if (aud_st) {
+char *audio_str = codec_str;
+if (video_str_len) {
+codec_str[video_str_len] = ',';
+video_str_len += 1;
+audio_str += video_str_len;
+codec_str_size -= video_str_len;
+}
+if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP2) {
+snprintf(audio_str, codec_str_size, "mp4a.40.33");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP3) {
+snprintf(audio_str, codec_str_size, "mp4a.40.34");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AAC) {
+/* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 
5 and 29 respectively */
+snprintf(audio_str, codec_str_size, "mp4a.40.2");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A5");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
+snprintf(audio_str, codec_str_size, "mp4a.A6");
+} else {
+goto fail;
+}
+}
+
+return codec_str;
+
+fail:
+av_free(codec_str);
+return NULL;
+}
+
 static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
@@ -1076,7 +1134,7 @@ static int create_master_playlist(AVFormatContext *s,
 AVDictionary *options = NULL;
 unsigned int i, j;
 int m3u8_name_size, ret, bandwidth;
-char *m3u8_rel_name;
+char *m3u8_rel_name, *codec_str;
 
 input_vs->m3u8_created = 1;
 if (!hls->master_m3u8_created) {
@@ -1203,6 +1261,13 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
 
+codec_str = get_codec_str(vid_st, aud_st);
+
+if (codec_str) {
+avio_printf(master_pb, ",CODECS=\"%s\"", codec_str);
+av_free(codec_str);
+}
+
 if (vs->agroup && aud_st)
 avio_printf(master_pb, ",AUDIO=\"group_%s\"", vs->agroup);
 
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-24 Thread Jeyapal, Karthick
Thanks for your comments. I have uploaded new patchset v4 with suggested 
corrections.
Please ignore patchset v3.

On 11/24/17, 4:26 PM, "Mark Thompson"  wrote:
[…]
>> +s = x264_encoder_headers(x4->enc, &nal, &nnal);
>> +avctx->profile = nal->p_payload[5];
>
>AVCodecContext.profile should include some of the constraint_set_flags - see 
>.
Great! I was not aware of this. This would also resolve my constraint_set_flags 
problem in hlsenc.
>
>> +avctx->level = nal->p_payload[7];
>
>I don't much like the hard-coding of the offsets here.  Maybe add some asserts 
>so that it fails very quickly if something ever changes?  (I don't think it 
>will with libx264, but if it does then this is going to be putting nonsense in 
>the metadata.)
Have added asserts to check start code and nal type.
>
>>  
>> -s = x264_encoder_headers(x4->enc, &nal, &nnal);
>> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>>  avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!p)
>>  return AVERROR(ENOMEM);
>> 
>
>I think I preferred the version which only wrote the value if it isn't already 
>set.  If the user specifies a profile then it should use that or fail.
I am ok with both approaches. Let us take a final decision on this based on the 
result of the other patch submitted by carl.
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220701.html

regards,
Karthick



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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Paul B Mahol
On 11/21/17, Paul B Mahol  wrote:
> On 11/19/17, Nicolas George  wrote:
>> Thilo Borgmann (2017-11-19):
>>> Based on Dave's example I'd say the queue parameter defines the
>>> minimum of available tiles before output is generated.
>>>
>>> 'queue' -> 'min'
>>> 'queue' -> 'min_tiles'
>>> 'queue' -> 'min_available'
>>>
>>> I'd suggest something like that.
>>
>> "min" would imply a global minimum, the names you suggest do not contain
>> anything that suggests it applies only at the beginning, and neither
>> does "queue". I stick with "init_padding".
>
> This "clash" with padding option, and may confuse users.
>

Because there are no more comments can I assume pushing this patch as is OK?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add lv2 wrapper filter

2017-11-24 Thread Paul B Mahol
On 11/23/17, James Almer  wrote:
> On 11/23/2017 6:16 PM, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  configure|   4 +
>>  doc/filters.texi |  37 
>>  libavfilter/Makefile |   1 +
>>  libavfilter/af_lv2.c | 552
>> +++
>>  libavfilter/allfilters.c |   1 +
>>  5 files changed, 595 insertions(+)
>>  create mode 100644 libavfilter/af_lv2.c
>>
>> diff --git a/configure b/configure
>> index 3ec6407fb2..84c965ce4a 100755
>> --- a/configure
>> +++ b/configure
>> @@ -283,6 +283,7 @@ External library support:
>>--enable-libzimg enable z.lib, needed for zscale filter [no]
>>--enable-libzmq  enable message passing via libzmq [no]
>>--enable-libzvbi enable teletext support via libzvbi [no]
>> +  --enable-lv2 enable LV2 audio filtering [no]
>>--disable-lzma   disable lzma [autodetect]
>>--enable-decklinkenable Blackmagic DeckLink I/O support [no]
>>--enable-libndi_newtek   enable Newteck NDI I/O support [no]
>> @@ -1631,6 +1632,7 @@ EXTERNAL_LIBRARY_LIST="
>>  libzimg
>>  libzmq
>>  libzvbi
>> +lv2
>>  mediacodec
>>  openal
>>  opengl
>> @@ -3229,6 +3231,7 @@ hqdn3d_filter_deps="gpl"
>>  interlace_filter_deps="gpl"
>>  kerndeint_filter_deps="gpl"
>>  ladspa_filter_deps="ladspa libdl"
>> +lv2_filter_deps="lilv"
>
> This should be
>
> lv2_filter_deps="lv2"
>
>>  mcdeint_filter_deps="avcodec gpl"
>>  movie_filter_deps="avcodec avformat"
>>  mpdecimate_filter_deps="gpl"
>> @@ -5829,6 +5832,7 @@ enabled gmp   && require gmp gmp.h
>> mpz_export -lgmp
>>  enabled gnutls&& require_pkg_config gnutls gnutls
>> gnutls/gnutls.h gnutls_global_init
>>  enabled jni   && { [ $target_os = "android" ] && check_header
>> jni.h && enabled pthreads || die "ERROR: jni not found"; }
>>  enabled ladspa&& require_header ladspa.h
>> +enabled lv2   && require_pkg_config lilv lilv-0
>> "lilv-0/lilv/lilv.h" lilv_world_new
>
> And this should be
>
> require_pkg_config lv2 lilv-0 "lilv-0/lilv/lilv.h" lilv_world_new
>
>>  enabled libiec61883   && require libiec61883 libiec61883/iec61883.h
>> iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
>>  enabled libass&& require_pkg_config libass libass ass/ass.h
>> ass_library_init
>>  enabled libbluray && require_pkg_config libbluray libbluray
>> libbluray/bluray.h bd_open
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [PATCH] avfilter: add normalize filter

2017-11-24 Thread Paul B Mahol
On 11/23/17, Richard Ling  wrote:
> On Nov 21, 2017 10:32 PM, "Moritz Barsnick"  wrote:
>>
>> Nice. I personally appreciate your code comments, as I'm no big filter
>> author (yet).
>
> I've never made any contribution to ffmpeg before, so I'm almost certainly
> a bad example to follow :-P
>
> But I do like code to be well commented.
>
> Regards
> R.

I will apply this and fix couple of small issues.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/mov: fix crash in mov_read_sidx

2017-11-24 Thread John Stebbins
Use correct index into streams
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f3e86dfc6d..ddb1e59b85 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4816,7 +4816,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVFragmentStreamInfo * si;
 si = &item->stream_info[j];
 if (si->sidx_pts != AV_NOPTS_VALUE) {
-ref_st = c->fc->streams[i];
+ref_st = c->fc->streams[j];
 ref_sc = ref_st->priv_data;
 break;
 }
-- 
2.14.3

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


Re: [FFmpeg-devel] [avformat] Prevent undefined shift with wrap_bits > 63.

2017-11-24 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 10:56:07AM -0800, Dale Curtis wrote:
> On Tue, Nov 21, 2017 at 7:05 PM, Michael Niedermayer  > wrote:
> >
> > I dont think wrap_bits can/should be > 64 or do i miss something ?
> >
> 
> Good point, this seems true with the current code.
> 
> 
> >
> > maybe a av_assert* for that would be better.
> >
> 
> Done; used av_assert2().

>  utils.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> e49bb30e3ddb00bc9f6780c924bfe97e710d7e99  wrap_bits_v5.patch
> From 0297fdc52f043592235d93076f91d38c3df40a14 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Fri, 17 Nov 2017 13:35:56 -0800
> Subject: [PATCH] [avformat] Prevent undefined shift with wrap_bits > 64.
> 
> 2LL << (wrap_bits=64 - 1) does not fit in int64_t; change the
> code to use a uint64_t (2ULL) and add an av_assert2() to
> ensure wrap_bits <= 64.
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavformat/utils.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH] avfilter: add mix filter

2017-11-24 Thread Moritz Barsnick
On Mon, Nov 20, 2017 at 20:59:09 +0100, Paul B Mahol wrote:

Nit:

> +Specifiy how end of stream is determined.
   ^ Specify

I can't judge the rest, and didn't test.

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


Re: [FFmpeg-devel] [PATCH]lavc/avcodec: Allow libavcodec to overwrite profile and level

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 12:47:16AM +0100, Carl Eugen Hoyos wrote:
> 2017-11-23 22:58 GMT+01:00 Michael Niedermayer :
> > On Thu, Nov 23, 2017 at 04:01:06PM +0100, Carl Eugen Hoyos wrote:
> >> Hi!
> >>
> >> The (external) encoders may overwrite level and profile because of
> >> requested encoding properties, allowing libavcodec to (also) overwrite
> >> them in the context makes sense (and is already done in some cases
> >> afaict).
> >>
> >> Please comment, Carl Eugen
> >
> > If a user needs to generate a file with a specific profile/level
> > for example because its for broadcast, some specification or a hw
> > decoder.
> > How could he after this patch ensure that exactly the needed profile
> > is used?
> 
> Afair, x264 does change profile and / or level depending on properties
> set by the user. Currently there is no way for the libavcodec user to
> know that libx264 changed something.
> With this change the user can know that he does not get the
> requested values.
> 
> Or am I wrong and libx264 never overwrites requested values
> for level and / or profile?

IIUC (someone please correct me if iam wrong) libx264 can change
the profile/level to a compatible one.

The proposed API would allow any change.
That would add a requirement to the user apps to check if the actual
profile/level is compatible to the users requirements. And that would
make this require special treatment in many user apps, not just pass
user options to ffmpeg


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

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] [PATCH]lavc/avcodec: Allow libavcodec to overwrite profile and level

2017-11-24 Thread Hendrik Leppkes
On Fri, Nov 24, 2017 at 5:42 PM, Michael Niedermayer
 wrote:
> On Fri, Nov 24, 2017 at 12:47:16AM +0100, Carl Eugen Hoyos wrote:
>> 2017-11-23 22:58 GMT+01:00 Michael Niedermayer :
>> > On Thu, Nov 23, 2017 at 04:01:06PM +0100, Carl Eugen Hoyos wrote:
>> >> Hi!
>> >>
>> >> The (external) encoders may overwrite level and profile because of
>> >> requested encoding properties, allowing libavcodec to (also) overwrite
>> >> them in the context makes sense (and is already done in some cases
>> >> afaict).
>> >>
>> >> Please comment, Carl Eugen
>> >
>> > If a user needs to generate a file with a specific profile/level
>> > for example because its for broadcast, some specification or a hw
>> > decoder.
>> > How could he after this patch ensure that exactly the needed profile
>> > is used?
>>
>> Afair, x264 does change profile and / or level depending on properties
>> set by the user. Currently there is no way for the libavcodec user to
>> know that libx264 changed something.
>> With this change the user can know that he does not get the
>> requested values.
>>
>> Or am I wrong and libx264 never overwrites requested values
>> for level and / or profile?
>
> IIUC (someone please correct me if iam wrong) libx264 can change
> the profile/level to a compatible one.
>
> The proposed API would allow any change.
> That would add a requirement to the user apps to check if the actual
> profile/level is compatible to the users requirements. And that would
> make this require special treatment in many user apps, not just pass
> user options to ffmpeg
>

But this change doesn't actually change behavior. If you want to
propose a different wording to allow encoders to slightly adjust the
value in a compatible manner, we're all ears. :)

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


Re: [FFmpeg-devel] [PATCH 12/17] vaapi_decode: Ignore the profile when not useful

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:29 +
Mark Thompson  wrote:

> Enables VP8 decoding - the decoder places the the bitstream version
> in the profile field, which we want to ignore.
> ---
>  libavcodec/vaapi_decode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index d36ef906a2..572b3a40ac 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -324,7 +324,8 @@ static int
> vaapi_decode_make_config(AVCodecContext *avctx, int profile_match = 0;
>  if (avctx->codec_id != vaapi_profile_map[i].codec_id)
>  continue;
> -if (avctx->profile == vaapi_profile_map[i].codec_profile)
> +if (avctx->profile == vaapi_profile_map[i].codec_profile ||
> +vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN)
>  profile_match = 1;
>  for (j = 0; j < profile_count; j++) {
>  if (vaapi_profile_map[i].va_profile == profile_list[j]) {

First 12 parts look good.

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


Re: [FFmpeg-devel] [PATCH 13/17] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:30 +
Mark Thompson  wrote:

> This is needed by later hwaccel code to tell which encoding process
> was used for a particular frame, because hardware decoders may only
> support a subset of possible methods.
> ---
>  libavcodec/avcodec.h  | 6 ++
>  libavcodec/mjpegdec.c | 7 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0972df0bde..c1e68b1d13 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2897,6 +2897,12 @@ typedef struct AVCodecContext {
>  #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE  3
>  #define FF_PROFILE_HEVC_REXT4
>  
> +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0
> +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
> +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
> +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3
> +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
> +
>  /**
>   * level
>   * - encoding: Set by user.
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index e005dd0cd3..f01d44a169 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -2288,6 +2288,10 @@ int ff_mjpeg_decode_frame(AVCodecContext
> *avctx, void *data, int *got_frame, break;
>  case SOF0:
>  case SOF1:
> +if (start_code == SOF0)
> +s->avctx->profile =
> FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT;
> +else
> +s->avctx->profile =
> FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT; s->lossless= 0;
>  s->ls  = 0;
>  s->progressive = 0;
> @@ -2295,6 +2299,7 @@ int ff_mjpeg_decode_frame(AVCodecContext
> *avctx, void *data, int *got_frame, goto fail;
>  break;
>  case SOF2:
> +s->avctx->profile =
> FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT; s->lossless= 0;
>  s->ls  = 0;
>  s->progressive = 1;
> @@ -2302,6 +2307,7 @@ int ff_mjpeg_decode_frame(AVCodecContext
> *avctx, void *data, int *got_frame, goto fail;
>  break;
>  case SOF3:
> +s->avctx->profile =
> FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS; s->avctx->properties |=
> FF_CODEC_PROPERTY_LOSSLESS; s->lossless= 1;
>  s->ls  = 0;
> @@ -2310,6 +2316,7 @@ int ff_mjpeg_decode_frame(AVCodecContext
> *avctx, void *data, int *got_frame, goto fail;
>  break;
>  case SOF48:
> +s->avctx->profile = FF_PROFILE_MJPEG_JPEG_LS;
>  s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
>  s->lossless= 1;
>  s->ls  = 1;

LGTM


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


Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:24 +
Mark Thompson  wrote:

> ---
>  libavcodec/avcodec.h|  2 +-
>  libavcodec/decode.c |  2 +-
>  libavcodec/dxva2_h264.c |  6 +--
>  libavcodec/dxva2_hevc.c |  6 +--
>  libavcodec/dxva2_mpeg2.c|  6 +--
>  libavcodec/dxva2_vc1.c  | 12 +++---
>  libavcodec/dxva2_vp9.c  |  6 +--
>  libavcodec/hwaccels.h   | 98
> ++---
> libavcodec/mpegvideo_xvmc.c |  4 +- libavcodec/nvdec_h264.c |  2
> +- libavcodec/nvdec_hevc.c |  2 +-
>  libavcodec/nvdec_mpeg12.c   |  2 +-
>  libavcodec/nvdec_vc1.c  |  4 +-
>  libavcodec/nvdec_vp9.c  |  2 +-
>  libavcodec/vaapi_h264.c |  2 +-
>  libavcodec/vaapi_hevc.c |  2 +-
>  libavcodec/vaapi_mpeg2.c|  2 +-
>  libavcodec/vaapi_mpeg4.c|  4 +-
>  libavcodec/vaapi_vc1.c  |  4 +-
>  libavcodec/vaapi_vp9.c  |  2 +-
>  libavcodec/vdpau_h264.c |  2 +-
>  libavcodec/vdpau_hevc.c |  2 +-
>  libavcodec/vdpau_mpeg12.c   |  4 +-
>  libavcodec/vdpau_mpeg4.c|  2 +-
>  libavcodec/vdpau_vc1.c  |  4 +-
>  libavcodec/videotoolbox.c   | 12 +++---
>  26 files changed, 98 insertions(+), 98 deletions(-)

You're missing nvdec_mpeg4.

> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 1ae0344bb2..0972df0bde 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
>   * - encoding: unused.
>   * - decoding: Set by libavcodec
>   */
> -struct AVHWAccel *hwaccel;
> +const struct AVHWAccel *hwaccel;
>  
>  /**
>   * Hardware accelerator context.
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index dd6fce86eb..3feaa6c426 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1252,7 +1252,7 @@ static int hwaccel_init(AVCodecContext *avctx,
>  return AVERROR(ENOMEM);
>  }
>  
> -avctx->hwaccel = (AVHWAccel*)hwaccel;
> +avctx->hwaccel = hwaccel;
>  err = hwaccel->init(avctx);
>  if (err < 0) {
>  av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: "
> diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
> index ee35b20e82..a4278c80b5 100644
> --- a/libavcodec/dxva2_h264.c
> +++ b/libavcodec/dxva2_h264.c
> @@ -518,7 +518,7 @@ static int dxva2_h264_end_frame(AVCodecContext
> *avctx) }
>  
>  #if CONFIG_H264_DXVA2_HWACCEL
> -AVHWAccel ff_h264_dxva2_hwaccel = {
> +const AVHWAccel ff_h264_dxva2_hwaccel = {
>  .name   = "h264_dxva2",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_H264,
> @@ -535,7 +535,7 @@ AVHWAccel ff_h264_dxva2_hwaccel = {
>  #endif
>  
>  #if CONFIG_H264_D3D11VA_HWACCEL
> -AVHWAccel ff_h264_d3d11va_hwaccel = {
> +const AVHWAccel ff_h264_d3d11va_hwaccel = {
>  .name   = "h264_d3d11va",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_H264,
> @@ -552,7 +552,7 @@ AVHWAccel ff_h264_d3d11va_hwaccel = {
>  #endif
>  
>  #if CONFIG_H264_D3D11VA2_HWACCEL
> -AVHWAccel ff_h264_d3d11va2_hwaccel = {
> +const AVHWAccel ff_h264_d3d11va2_hwaccel = {
>  .name   = "h264_d3d11va2",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_H264,
> diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
> index 542afc383a..0ae07d304f 100644
> --- a/libavcodec/dxva2_hevc.c
> +++ b/libavcodec/dxva2_hevc.c
> @@ -422,7 +422,7 @@ static int dxva2_hevc_end_frame(AVCodecContext
> *avctx) }
>  
>  #if CONFIG_HEVC_DXVA2_HWACCEL
> -AVHWAccel ff_hevc_dxva2_hwaccel = {
> +const AVHWAccel ff_hevc_dxva2_hwaccel = {
>  .name   = "hevc_dxva2",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_HEVC,
> @@ -439,7 +439,7 @@ AVHWAccel ff_hevc_dxva2_hwaccel = {
>  #endif
>  
>  #if CONFIG_HEVC_D3D11VA_HWACCEL
> -AVHWAccel ff_hevc_d3d11va_hwaccel = {
> +const AVHWAccel ff_hevc_d3d11va_hwaccel = {
>  .name   = "hevc_d3d11va",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_HEVC,
> @@ -456,7 +456,7 @@ AVHWAccel ff_hevc_d3d11va_hwaccel = {
>  #endif
>  
>  #if CONFIG_HEVC_D3D11VA2_HWACCEL
> -AVHWAccel ff_hevc_d3d11va2_hwaccel = {
> +const AVHWAccel ff_hevc_d3d11va2_hwaccel = {
>  .name   = "hevc_d3d11va2",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_HEVC,
> diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
> index df5fe59a7d..a57778b427 100644
> --- a/libavcodec/dxva2_mpeg2.c
> +++ b/libavcodec/dxva2_mpeg2.c
> @@ -317,7 +317,7 @@ static int dxva2_mpeg2_end_frame(AVCodecContext
> *avctx) }
>  
>  #if CONFIG_MPEG2_DXVA2_HWACCEL
> -AVHWAccel ff_mpeg2_dxva2_hwaccel = {
> +const AVHWAccel ff_mpeg2_dxva2_hwaccel = {
>  .name   = "mpeg2_dxva2",
>  .type   = AVMEDIA_TYPE_VIDEO,
>  .id = AV_CODEC_ID_MPEG2VIDEO,
> @@ -334,7 +334,7 @@ AVHWAccel ff_mpeg2_dxva2_hwaccel = {
>  #endif
>  

Re: [FFmpeg-devel] [PATCH 02/17] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:19 +
Mark Thompson  wrote:

> This includes a pointer to the associated hwaccel for decoders using
> hwaccels - these will be used later to implement the hwaccel setup
> without needing a global list.
> 
> Also added is a new file listing all hwaccels as external
> declarations - this will be used later to generate the hwaccel list
> at configure time. ---
>  libavcodec/cuviddec.c  | 15 ++
>  libavcodec/h263dec.c   | 13 
>  libavcodec/h264dec.c   | 25 
>  libavcodec/hevcdec.c   | 25 
>  libavcodec/hwaccel.h   | 50 +++
>  libavcodec/hwaccels.h  | 74
> ++
> libavcodec/mediacodecdec.c | 18 +++
> libavcodec/mmaldec.c   |  7 + libavcodec/mpeg12dec.c | 45
> +++- libavcodec/mpeg4videodec.c | 16
> ++ libavcodec/qsvdec.c| 13 
>  libavcodec/qsvdec.h|  3 ++
>  libavcodec/qsvdec_h2645.c  |  2 ++
>  libavcodec/qsvdec_other.c  |  3 ++
>  libavcodec/vc1dec.c| 43 +++
>  libavcodec/vp9.c   | 19 
>  16 files changed, 370 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/hwaccels.h
> 
> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
> index 806dab2074..3bd2409ea2 100644
> --- a/libavcodec/cuviddec.c
> +++ b/libavcodec/cuviddec.c
> @@ -32,6 +32,7 @@
>  
>  #include "avcodec.h"
>  #include "decode.h"
> +#include "hwaccel.h"
>  #include "internal.h"
>  
>  typedef struct CuvidContext
> @@ -1094,6 +1095,19 @@ static const AVOption options[] = {
>  { NULL }
>  };
>  
> +static const AVCodecHWConfigInternal *cuvid_hw_configs[] = {
> +&(const AVCodecHWConfigInternal) {
> +.public = {
> +.pix_fmt = AV_PIX_FMT_CUDA,
> +.methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
> +   AV_CODEC_HW_CONFIG_METHOD_INTERNAL,
> +.device_type = AV_HWDEVICE_TYPE_CUDA
> +},
> +.hwaccel = NULL,
> +},
> +NULL
> +};
> +
>  #define DEFINE_CUVID_CODEC(x, X) \
>  static const AVClass x##_cuvid_class = { \
>  .class_name = #x "_cuvid", \
> @@ -1127,6 +1141,7 @@ static const AVOption options[] = {
>  AV_PIX_FMT_P010,
> \ AV_PIX_FMT_P016, \
>  AV_PIX_FMT_NONE },
> \
> +.hw_configs = cuvid_hw_configs, \
>  };
>  
>  #if CONFIG_HEVC_CUVID_DECODER
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index b222de793b..5608b63245 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -33,6 +33,7 @@
>  #include "flv.h"
>  #include "h263.h"
>  #include "h263_parser.h"
> +#include "hwaccel.h"
>  #include "internal.h"
>  #include "mpeg_er.h"
>  #include "mpeg4video.h"
> @@ -759,4 +760,16 @@ AVCodec ff_h263p_decoder = {
>  .flush  = ff_mpeg_flush,
>  .max_lowres = 3,
>  .pix_fmts   = ff_h263_hwaccel_pixfmt_list_420,
> +.hw_configs = (const AVCodecHWConfigInternal*[]) {
> +#if CONFIG_H263_VAAPI_HWACCEL
> +HWACCEL_VAAPI(h263),
> +#endif
> +#if CONFIG_MPEG4_VDPAU_HWACCEL
> +HWACCEL_VDPAU(mpeg4),
> +#endif
> +#if CONFIG_H263_VIDEOTOOLBOX_HWACCEL
> +HWACCEL_VIDEOTOOLBOX(h263),
> +#endif
> +NULL
> +},
>  };
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index be187eb5f4..b03024d4a3 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -47,6 +47,7 @@
>  #include "h264_mvpred.h"
>  #include "h264_ps.h"
>  #include "golomb.h"
> +#include "hwaccel.h"
>  #include "mathops.h"
>  #include "me_cmp.h"
>  #include "mpegutils.h"
> @@ -1059,6 +1060,30 @@ AVCodec ff_h264_decoder = {
>  .capabilities  = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/
> AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
>   AV_CODEC_CAP_FRAME_THREADS,
> +.hw_configs= (const AVCodecHWConfigInternal*[]) {
> +#if CONFIG_H264_DXVA2_HWACCEL
> +   HWACCEL_DXVA2(h264),
> +#endif
> +#if CONFIG_H264_D3D11VA_HWACCEL
> +   HWACCEL_D3D11VA(h264),
> +#endif
> +#if CONFIG_H264_D3D11VA2_HWACCEL
> +   HWACCEL_D3D11VA2(h264),
> +#endif
> +#if CONFIG_H264_NVDEC_HWACCEL
> +   HWACCEL_NVDEC(h264),
> +#endif
> +#if CONFIG_H264_VAAPI_HWACCEL
> +   HWACCEL_VAAPI(h264),
> +#endif
> +#if CONFIG_H264_VDPAU_HWACCEL
> +   HWACCEL_VDPAU(h264),
> +#endif
> +#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
> +   HWACCEL_VIDEOTOOLBOX(h264),
> +#endif
> +   NULL
> +   },
>  .caps

Re: [FFmpeg-devel] [vorbis] 1 << 31 > int32_t::max(), so use 1u << 31 instead.

2017-11-24 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 10:59:48AM -0800, Dale Curtis wrote:
> 

>  vorbis.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> cc6147c6f734e06bfe23d0123d8b24a02273431c  vorbis_fix_v1.patch
> From fa070a9b47f6bef2a12cabdd5854e1dc1a0d4c32 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Wed, 22 Nov 2017 10:58:39 -0800
> Subject: [PATCH] [vorbis] 1 << 31 > int32_t::max(), so use 1u << 31 instead.
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavcodec/vorbis.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH]lavc/avcodec: Allow libavcodec to overwrite profile and level

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 05:50:36PM +0100, Hendrik Leppkes wrote:
> On Fri, Nov 24, 2017 at 5:42 PM, Michael Niedermayer
>  wrote:
> > On Fri, Nov 24, 2017 at 12:47:16AM +0100, Carl Eugen Hoyos wrote:
> >> 2017-11-23 22:58 GMT+01:00 Michael Niedermayer :
> >> > On Thu, Nov 23, 2017 at 04:01:06PM +0100, Carl Eugen Hoyos wrote:
> >> >> Hi!
> >> >>
> >> >> The (external) encoders may overwrite level and profile because of
> >> >> requested encoding properties, allowing libavcodec to (also) overwrite
> >> >> them in the context makes sense (and is already done in some cases
> >> >> afaict).
> >> >>
> >> >> Please comment, Carl Eugen
> >> >
> >> > If a user needs to generate a file with a specific profile/level
> >> > for example because its for broadcast, some specification or a hw
> >> > decoder.
> >> > How could he after this patch ensure that exactly the needed profile
> >> > is used?
> >>
> >> Afair, x264 does change profile and / or level depending on properties
> >> set by the user. Currently there is no way for the libavcodec user to
> >> know that libx264 changed something.
> >> With this change the user can know that he does not get the
> >> requested values.
> >>
> >> Or am I wrong and libx264 never overwrites requested values
> >> for level and / or profile?
> >
> > IIUC (someone please correct me if iam wrong) libx264 can change
> > the profile/level to a compatible one.
> >
> > The proposed API would allow any change.
> > That would add a requirement to the user apps to check if the actual
> > profile/level is compatible to the users requirements. And that would
> > make this require special treatment in many user apps, not just pass
> > user options to ffmpeg
> >
> 

> But this change doesn't actually change behavior. If you want to

No change to any (API) documentation changes implementation behavior.

It allows though implementations to change behavior and then also
requires the other side of the interface to support this.

aka badly worded API docs can lead to misunderstanding and pain


> propose a different wording to allow encoders to slightly adjust the
> value in a compatible manner, we're all ears. :)

Maybe something like this:

An encoder may change this to a compatible profile / level.
For example if profile.level 5.7 requires decoder support of lower
levels then an encoder may choose to use 5.6 instead and update these
fields.

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH] avfilter: add lv2 wrapper filter

2017-11-24 Thread Derek Buitenhuis
On 11/23/2017 9:16 PM, Paul B Mahol wrote:

> +typedef struct LV2Context {
> +const AVClass *class;
> +char *plugin_uri;
> +char *options;
> +
> +unsigned long nb_inputs;
> +unsigned long nb_inputcontrols;
> +unsigned long nb_outputs;

Why are you using longs instead of stdint?

> +table->uris = av_realloc(table->uris, ++table->n_uris * sizeof(char*));
> +table->uris[table->n_uris - 1] = av_malloc(len + 1);

Every single allocation in this whole file is completely unchecked. That's not 
OK.

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


Re: [FFmpeg-devel] [PATCH 14/17] mjpegdec: Add hwaccel hooks

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:31 +
Mark Thompson  wrote:

> Also adds some extra fields to the main context structure that may
> be needed by a hwaccel decoder.
> ---
> The YUVJ formats really mess with this.  This patch hacks them out so
> that the hwaccel works, suggestions welcome on what to actually do
> about them.
> 
> 
>  libavcodec/mjpegdec.c | 70
> +--
> libavcodec/mjpegdec.h | 11  2 files changed, 79
> insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index f01d44a169..846dec2f42 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -36,6 +36,7 @@
>  #include "avcodec.h"
>  #include "blockdsp.h"
>  #include "copy_block.h"
> +#include "hwaccel.h"
>  #include "idctdsp.h"
>  #include "internal.h"
>  #include "jpegtables.h"
> @@ -147,6 +148,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext
> *avctx) s->org_height= avctx->coded_height;
>  avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
>  avctx->colorspace = AVCOL_SPC_BT470BG;
> +s->hwaccel_pix_fmt = s->hwaccel_sw_pix_fmt = AV_PIX_FMT_NONE;
>  
>  if ((ret = build_basic_mjpeg_vlc(s)) < 0)
>  return ret;
> @@ -279,6 +281,11 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
>   code_max + 1, 0, 0)) < 0)
>  return ret;
>  }
> +
> +for (i = 0; i < 16; i++)
> +s->raw_huffman_lengths[class][index][i] = bits_table[i +
> 1];
> +for (i = 0; i < 256; i++)
> +s->raw_huffman_values[class][index][i] = val_table[i];
>  }
>  return 0;
>  }
> @@ -636,6 +643,26 @@ unk_pixfmt:
>  return AVERROR_BUG;
>  }
>  
> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ420P)
> +s->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> +if (s->avctx->pix_fmt == AV_PIX_FMT_YUVJ422P)
> +s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
> +
> +if (s->avctx->pix_fmt == s->hwaccel_sw_pix_fmt) {
> +s->avctx->pix_fmt = s->hwaccel_pix_fmt;
> +} else {
> +enum AVPixelFormat pix_fmts[] = {
> +s->avctx->pix_fmt,
> +AV_PIX_FMT_NONE,
> +};
> +s->hwaccel_pix_fmt = ff_get_format(s->avctx, pix_fmts);
> +if (s->hwaccel_pix_fmt < 0)
> +return AVERROR(EINVAL);
> +
> +s->hwaccel_sw_pix_fmt = s->avctx->pix_fmt;
> +s->avctx->pix_fmt = s->hwaccel_pix_fmt;
> +}
> +

If I'm reading this right, your hack here means that the pix_fmt is
changed for all usage, whether hwaccel is used or not, right?
Presumably you just want to do this if an hwaccel ends up being used;
so at least you want to restore the original fmt in the non-hwaccel
case?

>  if (s->avctx->skip_frame == AVDISCARD_ALL) {
>  s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
>  s->picture_ptr->key_frame = 1;
> @@ -683,6 +710,19 @@ unk_pixfmt:
>  }
>  memset(s->coefs_finished, 0, sizeof(s->coefs_finished));
>  }
> +
> +if (s->avctx->hwaccel) {
> +s->hwaccel_picture_private =
> +av_mallocz(s->avctx->hwaccel->frame_priv_data_size);
> +if (!s->hwaccel_picture_private)
> +return AVERROR(ENOMEM);
> +
> +ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_buffer,
> + s->raw_buffer_size);

nvdec needs the entire avpkt->data to be able to decode successfully.

> +if (ret < 0)
> +return ret;
> +}
> +
>  return 0;
>  }
>  
> @@ -1510,7 +1550,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s,
> const uint8_t *mb_bitmask, }
>  }
>  
> -av_assert0(s->picture_ptr->data[0]);
> +//av_assert0(s->picture_ptr->data[0]);
>  /* XXX: verify len field validity */
>  len = get_bits(&s->gb, 16);
>  nb_components = get_bits(&s->gb, 8);
> @@ -1600,7 +1640,18 @@ next_field:
>  for (i = 0; i < nb_components; i++)
>  s->last_dc[i] = (4 << s->bits);
>  
> -if (s->lossless) {
> +if (s->avctx->hwaccel) {
> +int bytes_to_start = get_bits_count(&s->gb) / 8;
> +av_assert0(bytes_to_start >= 0 &&
> +   s->raw_buffer_size >= bytes_to_start);
> +
> +ret = s->avctx->hwaccel->decode_slice(s->avctx,
> +  s->raw_buffer  +
> bytes_to_start,
> +  s->raw_buffer_size -
> bytes_to_start);
> +if (ret < 0)
> +return ret;
> +
> +} else if (s->lossless) {
>  av_assert0(s->picture_ptr == s->picture);
>  if (CONFIG_JPEGLS_DECODER && s->ls) {
>  //for () {
> @@ -2226,6 +2277,9 @@ int ff_mjpeg_decode_frame(AVCodecContext
> *avctx, void *data, int *got_frame, goto fail;
>  }
>  
> +s->raw_buffer  = buf_ptr;
> +s->raw_buffer_size = buf_end - buf_ptr;
> +
>  s->start_code = start_code;
>  if (s->avctx->debug & FF_DEBU

Re: [FFmpeg-devel] [PATCH 1/2] avocdec/ttaenc: buffer packets directly

2017-11-24 Thread James Almer
On 11/23/2017 2:00 AM, James Almer wrote:
> On 11/20/2017 5:44 PM, James Almer wrote:
>> This is a bit more robust in case of OOM.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavformat/ttaenc.c | 42 +-
>>  1 file changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
>> index fdce1e3dc1..b05705b6b6 100644
>> --- a/libavformat/ttaenc.c
>> +++ b/libavformat/ttaenc.c
>> @@ -29,7 +29,7 @@
>>  
>>  typedef struct TTAMuxContext {
>>  AVIOContext *seek_table;
>> -AVIOContext *data;
>> +AVPacketList *queue, *queue_end;
>>  uint32_t nb_samples;
>>  int frame_size;
>>  int last_frame;
>> @@ -56,10 +56,6 @@ static int tta_write_header(AVFormatContext *s)
>>  
>>  if ((ret = avio_open_dyn_buf(&tta->seek_table)) < 0)
>>  return ret;
>> -if ((ret = avio_open_dyn_buf(&tta->data)) < 0) {
>> -ffio_free_dyn_buf(&tta->seek_table);
>> -return ret;
>> -}
>>  
>>  /* Ignore most extradata information if present. It can be innacurate
>> if for example remuxing from Matroska */
>> @@ -84,8 +80,23 @@ static int tta_write_header(AVFormatContext *s)
>>  static int tta_write_packet(AVFormatContext *s, AVPacket *pkt)
>>  {
>>  TTAMuxContext *tta = s->priv_data;
>> +AVPacketList *pktl = av_mallocz(sizeof(*pktl));
>> +int ret;
>> +
>> +if (!pktl)
>> +return AVERROR(ENOMEM);
>> +
>> +ret = av_packet_ref(&pktl->pkt, pkt);
>> +if (ret < 0) {
>> +av_free(pktl);
>> +return ret;
>> +}
>> +if (tta->queue_end)
>> +tta->queue_end->next = pktl;
>> +else
>> +tta->queue = pktl;
>> +tta->queue_end = pktl;
>>  
>> -avio_write(tta->data, pkt->data, pkt->size);
>>  avio_wl32(tta->seek_table, pkt->size);
>>  tta->nb_samples += pkt->duration;
>>  
>> @@ -106,6 +117,21 @@ static int tta_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>  return 0;
>>  }
>>  
>> +static void tta_queue_flush(AVFormatContext *s)
>> +{
>> +TTAMuxContext *tta = s->priv_data;
>> +AVPacketList *pktl;
>> +
>> +while (pktl = tta->queue) {
>> +AVPacket *pkt = &pktl->pkt;
>> +avio_write(s->pb, pkt->data, pkt->size);
>> +av_packet_unref(pkt);
>> +tta->queue = pktl->next;
>> +av_free(pktl);
>> +}
>> +tta->queue_end = NULL;
>> +}
>> +
>>  static int tta_write_trailer(AVFormatContext *s)
>>  {
>>  TTAMuxContext *tta = s->priv_data;
>> @@ -125,9 +151,7 @@ static int tta_write_trailer(AVFormatContext *s)
>>  av_free(ptr);
>>  
>>  /* Write audio data */
>> -size = avio_close_dyn_buf(tta->data, &ptr);
>> -avio_write(s->pb, ptr, size);
>> -av_free(ptr);
>> +tta_queue_flush(s);
>>  
>>  ff_ape_write_tag(s);
>>  avio_flush(s->pb);
> 
> Ping.

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Nicolas George
Paul B Mahol (2017-11-24):
> Because there are no more comments can I assume pushing this patch as is OK?

Depends on how you amended it after the discussion.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Paul B Mahol
On 11/24/17, Nicolas George  wrote:
> Paul B Mahol (2017-11-24):
>> Because there are no more comments can I assume pushing this patch as is
>> OK?
>
> Depends on how you amended it after the discussion.

What you want to change?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Nicolas George
Paul B Mahol (2017-11-24):
> What you want to change?

The name of the option and its documentation. The documentation was
unclear, and if there was a consensus about the name of the option, it
was not for "queue".

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] avcodec/nvdec: Round up odd width/height values

2017-11-24 Thread Philip Langdale
nvdec will not produce odd width/height output, and while this is
basically never an issue with most codecs, due to internal alignment
requirements, you can get odd sized jpegs.

If an odd-sized jpb is encountered, nvdec will actually round down
internally and produce output that is slightly smaller. This isn't
the end of the world, as long as you know the output size doesn't
match the original image resolution.

However, with an hwaccel, we don't know. The decoder controls
the reported output size and the hwaccel cannot change it. I was
able to trigger an error in mpv where it tries to copy the output
surface as part of rendering and triggers a cuda error because
cuda knows the output frame is smaller than expected.

To fix this, we can round up the configured width/height passed
to nvdec so that the frames are always at least as large as the
decoder's reported size, and data can be copied out safely.

In this particular jpeg case, you end up with a blank (green) line
at the bottom due to nvdec refusing to decode the last line, but
the behaviour matches cuviddec, so it's as good as you're going to
get.

Signed-off-by: Philip Langdale 
---
 libavcodec/nvdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 206429c603..dc7badc4d9 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -534,8 +534,8 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
 }
 
 frames_ctx->format= AV_PIX_FMT_CUDA;
-frames_ctx->width = avctx->coded_width;
-frames_ctx->height= avctx->coded_height;
+frames_ctx->width = (avctx->coded_width + 1) & ~1;
+frames_ctx->height= (avctx->coded_height + 1) & ~1;
 frames_ctx->initial_pool_size = dpb_size;
 
 switch (sw_desc->comp[0].depth) {
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH 14/17] mjpegdec: Add hwaccel hooks

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 12:51:31AM +, Mark Thompson wrote:
> Also adds some extra fields to the main context structure that may
> be needed by a hwaccel decoder.
> ---
> The YUVJ formats really mess with this.  This patch hacks them out so that 
> the hwaccel works, suggestions welcome on what to actually do about them.

Can you explain what the problem is exactly ?


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Paul B Mahol
On 11/24/17, Nicolas George  wrote:
> Paul B Mahol (2017-11-24):
>> What you want to change?
>
> The name of the option and its documentation. The documentation was
> unclear, and if there was a consensus about the name of the option, it
> was not for "queue".

But for what option instead was consensus?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add lv2 wrapper filter

2017-11-24 Thread Paul B Mahol
On 11/24/17, Derek Buitenhuis  wrote:
> On 11/23/2017 9:16 PM, Paul B Mahol wrote:
>
>> +typedef struct LV2Context {
>> +const AVClass *class;
>> +char *plugin_uri;
>> +char *options;
>> +
>> +unsigned long nb_inputs;
>> +unsigned long nb_inputcontrols;
>> +unsigned long nb_outputs;
>
> Why are you using longs instead of stdint?

Fixed.

>
>> +table->uris = av_realloc(table->uris, ++table->n_uris *
>> sizeof(char*));
>> +table->uris[table->n_uris - 1] = av_malloc(len + 1);
>
> Every single allocation in this whole file is completely unchecked. That's
> not OK.

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


Re: [FFmpeg-devel] [PATCH] libavcodec/opus: Add NULL pointer check for incoming data; avoid segfault

2017-11-24 Thread Colin NG
It still crashes with the following change. It crashes at 
ff_pvq_search_exact_avx () instead. We should wait for your improvement to fix 
the crash.


Colin



From: ffmpeg-devel  on behalf of Rostislav 
Pehlivanov 
Sent: November 22, 2017 8:02 PM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/opus: Add NULL pointer check for 
incoming data; avoid segfault

On 23 November 2017 at 00:53, Colin NG  wrote:

> ---
> Fix for ticket 7674
>
>  libavcodec/opus_pvq.c | 16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
> index f98b85d..02ccd69 100644
> --- a/libavcodec/opus_pvq.c
> +++ b/libavcodec/opus_pvq.c
> @@ -504,6 +504,9 @@ static av_always_inline uint32_t
> quant_band_template(CeltPVQ *pvq, CeltFrame *f,
>  int longblocks = (B0 == 1);
>  uint32_t cm = 0;
>
> + if (!X)
> +return cm;
> +
>  if (N == 1) {
>  float *x = X;
>  for (i = 0; i <= stereo; i++) {
> @@ -795,7 +798,7 @@ static av_always_inline uint32_t
> quant_band_template(CeltPVQ *pvq, CeltFrame *f,
>  f->remaining2 -= curr_bits;
>  }
>
> -if (q != 0) {
> +if (X && !q) {
>  /* Finally do the actual (de)quantization */
>  if (quant) {
>  cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7))
> << ((q >> 3) - 1),
> @@ -902,6 +905,9 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f,
> OpusRangeCoder *rc, int b
>  float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] <<
> f->size);
>  OPUS_RC_CHECKPOINT_SPAWN(rc);
>
> +if (!X && !Y)
> +return 0.0f;
> +
>  memcpy(X, X_orig, band_size*sizeof(float));
>  if (Y)
>  memcpy(Y, Y_orig, band_size*sizeof(float));
> @@ -911,7 +917,6 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f,
> OpusRangeCoder *rc, int b
>  int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band);
>  b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] +
> curr_balance), 14);
>  }
> -
>  if (f->dual_stereo) {
>  pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2,
> f->blocks, NULL,
>   f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]);
> @@ -925,7 +930,12 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame
> *f, OpusRangeCoder *rc, int b
>
>  for (i = 0; i < band_size; i++) {
>  err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
> -err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
> +}
> +
> +   if (Y) {
> +for (i = 0; i < band_size; i++) {
> +err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
> +}
>  }
>
>  dist = sqrtf(err_x) + sqrtf(err_y);
> --
> 2.7.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
ffmpeg-devel Info Page
ffmpeg.org
This list is about FFmpeg development discussions and patches; but not for 
bug-reports. Please read the Code-of-conduct. To see the collection of prior 
postings to ...



>


I actually found out about this bug while working on it a few days ago but
wanted to wait until I got the opus_rc and some opusenc_psy improvements
fully done.
Pushed my fix for mono. I disagree with the rest. There should always be a
channel of audio (X) to analyze.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
ffmpeg-devel Info Page
ffmpeg.org
This list is about FFmpeg development discussions and patches; but not for 
bug-reports. Please read the Code-of-conduct. To see the collection of prior 
postings to ...



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


Re: [FFmpeg-devel] [PATCH] avcodec/nvdec: Round up odd width/height values

2017-11-24 Thread Timo Rothenpieler

Am 24.11.2017 um 19:24 schrieb Philip Langdale:

nvdec will not produce odd width/height output, and while this is
basically never an issue with most codecs, due to internal alignment
requirements, you can get odd sized jpegs.

If an odd-sized jpb is encountered, nvdec will actually round down


jpg


internally and produce output that is slightly smaller. This isn't
the end of the world, as long as you know the output size doesn't
match the original image resolution.

However, with an hwaccel, we don't know. The decoder controls
the reported output size and the hwaccel cannot change it. I was
able to trigger an error in mpv where it tries to copy the output
surface as part of rendering and triggers a cuda error because
cuda knows the output frame is smaller than expected.

To fix this, we can round up the configured width/height passed
to nvdec so that the frames are always at least as large as the
decoder's reported size, and data can be copied out safely.

In this particular jpeg case, you end up with a blank (green) line
at the bottom due to nvdec refusing to decode the last line, but
the behaviour matches cuviddec, so it's as good as you're going to
get.

Signed-off-by: Philip Langdale 
---
  libavcodec/nvdec.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 206429c603..dc7badc4d9 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -534,8 +534,8 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
  }
  
  frames_ctx->format= AV_PIX_FMT_CUDA;

-frames_ctx->width = avctx->coded_width;
-frames_ctx->height= avctx->coded_height;
+frames_ctx->width = (avctx->coded_width + 1) & ~1;
+frames_ctx->height= (avctx->coded_height + 1) & ~1;
  frames_ctx->initial_pool_size = dpb_size;
  
  switch (sw_desc->comp[0].depth) {




lgtm



smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/2] alloc NULL check fuzzer finds

2017-11-24 Thread Derek Buitenhuis
This was from a single FATE pass, an only 2 of the 10+ found.

Going to send the tool I use to fuzz it to the list as well.

Derek Buitenhuis (2):
  h264_picture: Actually return error during alloc failure
  vorbisenc: Check the return value of av_frame_clone

 libavcodec/h264_picture.c | 12 +---
 libavcodec/vorbisenc.c|  6 +-
 2 files changed, 14 insertions(+), 4 deletions(-)

-- 
2.15.0

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


[FFmpeg-devel] [PATCH 2/2] vorbisenc: Check the return value of av_frame_clone

2017-11-24 Thread Derek Buitenhuis
Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/vorbisenc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index a4ecd8f754..18a679f2dc 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -1093,9 +1093,13 @@ static int vorbis_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 PutBitContext pb;
 
 if (frame) {
+AVFrame *clone;
 if ((ret = ff_af_queue_add(&venc->afq, frame)) < 0)
 return ret;
-ff_bufqueue_add(avctx, &venc->bufqueue, av_frame_clone(frame));
+clone = av_frame_clone(frame);
+if (!clone)
+return AVERROR(ENOMEM);
+ff_bufqueue_add(avctx, &venc->bufqueue, clone);
 } else
 if (!venc->afq.remaining_samples)
 return 0;
-- 
2.15.0

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


[FFmpeg-devel] [PATCH 1/2] h264_picture: Actually return error during alloc failure

2017-11-24 Thread Derek Buitenhuis
Fixes NULL dereference during alloc failure.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/h264_picture.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index e7dd84bc47..e833835a77 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -78,24 +78,30 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, 
H264Picture *src)
 
 dst->qscale_table_buf = av_buffer_ref(src->qscale_table_buf);
 dst->mb_type_buf  = av_buffer_ref(src->mb_type_buf);
-if (!dst->qscale_table_buf || !dst->mb_type_buf)
+if (!dst->qscale_table_buf || !dst->mb_type_buf) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->qscale_table = src->qscale_table;
 dst->mb_type  = src->mb_type;
 
 for (i = 0; i < 2; i++) {
 dst->motion_val_buf[i] = av_buffer_ref(src->motion_val_buf[i]);
 dst->ref_index_buf[i]  = av_buffer_ref(src->ref_index_buf[i]);
-if (!dst->motion_val_buf[i] || !dst->ref_index_buf[i])
+if (!dst->motion_val_buf[i] || !dst->ref_index_buf[i]) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->motion_val[i] = src->motion_val[i];
 dst->ref_index[i]  = src->ref_index[i];
 }
 
 if (src->hwaccel_picture_private) {
 dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
-if (!dst->hwaccel_priv_buf)
+if (!dst->hwaccel_priv_buf) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
 }
 
-- 
2.15.0

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


[FFmpeg-devel] [PATCH 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Derek Buitenhuis
I've had this kicking around for like 4 years, maybe it can be of use to some 
people.
I haven't done full scale fuzzing with this because laziness. I just sometimes 
run it
when I'm bored. It's not thread-safe, but it would be trivial to make it so.

It's based off my old LD_PRELOAD hack from here:

https://gist.github.com/dwbuiten/7101755

Optionally takes two env vars, MALLOC_SEED (the seed), and MALLOC_FAILPROB for 
the
probability of failing.

I've been running it directly integrated inside FFmpeg's allocator because it 
makes
it easier to run under gdb to find where it actually crashes, if the stack 
trace of
the failure is not enough info/context.

Currently FFmpeg has a lot of unchecked allocations - just one single FATE run 
with
this found:

daemon404@bbvm:~/dev/f/ffmpeg/tests/data/fate$ grep Seg *.err
adpcm-ima-amv.err:Segmentation fault
adpcm-ima-apc.err:Segmentation fault
caf.err:Segmentation fault
filter-mergeplanes.err:Segmentation fault
filter-paletteuse-bayer.err:Segmentation fault
filter-paletteuse-sierra2_4a.err:Segmentation fault
lavf-wav.err:Segmentation fault
lavf-wav_peak.err:Segmentation fault
lavf-wav_peak_only.err:Segmentation fault
vorbis-encode.err:Segmentation fault
vsynth1-msvideo1.err:Segmentation fault

Plus an infinite EAGAIN loop with av_usleep ffmpeg.c, that I'm still trying to
debug.

It prints a stack trace when it fails so that you know which allocation failed:

daemon404@bbvm:~/dev/f/ffmpeg/tests/data/fate$ cat vorbis-encode.err

[... snip ...]

FAILED. Iteration = 9789, Seed = 1511549218.

my_posix_memalign:77 in libavutil/posixmemalign.c
av_malloc:89 in libavutil/mem.c
av_mallocz:240 in libavutil/mem.c
av_frame_alloc:152 in libavutil/frame.c
av_frame_clone:499 in libavutil/frame.c
vorbis_encode_frame:1098 in libavcodec/vorbisenc.c
avcodec_encode_audio2:198 in libavcodec/encode.c
do_encode:377 in libavcodec/encode.c
avcodec_send_frame:423 in libavcodec/encode.c
do_audio_out:931 in fftools/ffmpeg.c
reap_filters:1507 in fftools/ffmpeg.c
transcode_step:4562 in fftools/ffmpeg.c
transcode:4606 in fftools/ffmpeg.c
main:4812 in fftools/ffmpeg.c
(null):0 in (null)
(null):0 in (null)
(null):0 in (null)
Segmentation fault

The (null) stuff is noise from libbacktrace, and could be skipped with a proper
callback.

And e.g. to reproduce this under gdb:

$ MALLOC_SEED=1511549218 gdb --args /home/daemon404/dev/f/ffmpeg/ffmpeg_g \
  -nostdin -nostats -cpuflags all -hwaccel none -threads 1 -thread_type 
frame+slice \ 
  -i /home/daemon404/fate/audio-reference/luckynight_2ch_44kHz_s16.wav -c:a 
vorbis \
  -strict experimental -f ogg -y 
/home/daemon404/dev/f/ffmpeg/tests/data/fate/vorbis-encode.ogg

(Obtained from 'make fate-vorbis-encode V=1'.)

Currently it's using libbacktrace from GCC, which can be build entirely 
separately from
GDB (cd libbacktrace && ./configure && make && cp backtrace.h 
/usr/local/include &&
cp .libs/libbacktrace.a /usr/local/lib). Add -lbacktrace to extra-libs. Hacky? 
Yeah...

Derek Buitenhuis (1):
  Allocation NULL check fuzzing tool

 libavutil/mem.c   |  4 ++-
 libavutil/posixmemalign.c | 86 +++
 2 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/posixmemalign.c

-- 
2.15.0

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


[FFmpeg-devel] [PATCH 1/1][NO NOT APPLY] Allocation NULL check fuzzing tool

2017-11-24 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavutil/mem.c   |  4 ++-
 libavutil/posixmemalign.c | 86 +++
 2 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/posixmemalign.c

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 6ad409daf4..0d9ab3d230 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -43,6 +43,8 @@
 #include "intreadwrite.h"
 #include "mem.h"
 
+#include "posixmemalign.c"
+
 #ifdef MALLOC_PREFIX
 
 #define malloc AV_JOIN(MALLOC_PREFIX, malloc)
@@ -84,7 +86,7 @@ void *av_malloc(size_t size)
 
 #if HAVE_POSIX_MEMALIGN
 if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation
-if (posix_memalign(&ptr, ALIGN, size))
+if (my_posix_memalign(&ptr, ALIGN, size))
 ptr = NULL;
 #elif HAVE_ALIGNED_MALLOC
 ptr = _aligned_malloc(size, ALIGN);
diff --git a/libavutil/posixmemalign.c b/libavutil/posixmemalign.c
new file mode 100644
index 00..b1970add7b
--- /dev/null
+++ b/libavutil/posixmemalign.c
@@ -0,0 +1,86 @@
+/*
+ * posix_memalign wrapper with random failurres
+ *
+ * Copyright (c) 2013, Derek Buitenhuis
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define _GNU_SOURCE
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static void errprint(void *data, const char *msg, int errnum)
+{
+fprintf(stderr, "ERROR: %s.\n", msg);
+}
+
+static int stackprint(void *data, uintptr_t pc, const char *filename, int 
lineno, const char *function)
+{
+fprintf(stderr, "%s:%d in %s\n", function, lineno, filename);
+return 0;
+}
+
+static int my_posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+static time_t   seed  = 0;
+static int  prob  = 0;
+static uint64_t iteration = 0;
+int ret;
+
+struct backtrace_state *state = backtrace_create_state("", 1, errprint, 
NULL);
+
+if (state == NULL)
+abort();
+
+if (!seed) {
+char *usertime = getenv("MALLOC_SEED");
+
+if (!usertime)
+seed = time(NULL);
+else
+seed = atoi(usertime);
+
+srand(seed);
+}
+
+if (!prob) {
+char *userprob = getenv("MALLOC_FAILPROB");
+
+if (!userprob)
+prob = 1;
+else
+prob = atoi(userprob);
+}
+
+if (!(rand() % prob)) {
+fprintf(stderr,
+"\nFAILED. Iteration = %"PRId64", Seed = %lld.\n\n",
+iteration, (long long) seed);
+backtrace_full(state, 0, stackprint, errprint, NULL);
+ret = 0;
+} else {
+ret = posix_memalign(memptr, alignment, size);
+}
+
+iteration++;
+
+return ret;
+}
-- 
2.15.0

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


Re: [FFmpeg-devel] [PATCH v4 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 10:57:45AM +0530, Karthick J wrote:
> ---
>  libavformat/Makefile  |   2 +-
>  libavformat/hlsenc.c  | 115 +++
>  libavformat/hlsplaylist.c | 136 
> ++
>  libavformat/hlsplaylist.h |  51 +
>  4 files changed, 209 insertions(+), 95 deletions(-)
>  create mode 100644 libavformat/hlsplaylist.c
>  create mode 100644 libavformat/hlsplaylist.h

breaks build with mingw64

src/libavformat/hlsplaylist.c: In function ‘ff_hls_write_file_entry’:
src/libavformat/hlsplaylist.c:109:9: error: implicit declaration of function 
‘localtime_r’ [-Werror=implicit-function-declaration]
 tm = localtime_r(&tt, &tmpbuf);
 ^
src/libavformat/hlsplaylist.c:109:12: warning: assignment makes pointer from 
integer without a cast [enabled by default]
 tm = localtime_r(&tt, &tmpbuf);
^
src/libavformat/hlsplaylist.c:113:13: error: implicit declaration of function 
‘gmtime_r’ [-Werror=implicit-function-declaration]
 tm = gmtime_r(&tt, &tmpbuf);
 ^
src/libavformat/hlsplaylist.c:113:16: warning: assignment makes pointer from 
integer without a cast [enabled by default]
 tm = gmtime_r(&tt, &tmpbuf);
^
cc1: some warnings being treated as errors

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Paul B Mahol
On 11/24/17, Derek Buitenhuis  wrote:
> I've had this kicking around for like 4 years, maybe it can be of use to
> some people.
> I haven't done full scale fuzzing with this because laziness. I just
> sometimes run it
> when I'm bored. It's not thread-safe, but it would be trivial to make it so.
>
> It's based off my old LD_PRELOAD hack from here:
>
> https://gist.github.com/dwbuiten/7101755
>
> Optionally takes two env vars, MALLOC_SEED (the seed), and MALLOC_FAILPROB
> for the
> probability of failing.
>
> I've been running it directly integrated inside FFmpeg's allocator because
> it makes
> it easier to run under gdb to find where it actually crashes, if the stack
> trace of
> the failure is not enough info/context.
>
> Currently FFmpeg has a lot of unchecked allocations - just one single FATE
> run with
> this found:
>
> daemon404@bbvm:~/dev/f/ffmpeg/tests/data/fate$ grep Seg *.err
> adpcm-ima-amv.err:Segmentation fault
> adpcm-ima-apc.err:Segmentation fault
> caf.err:Segmentation fault
> filter-mergeplanes.err:Segmentation fault

Do you have backtrace of this one?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls demuxer: add option to defer parsing of variants

2017-11-24 Thread Rainer Hochecker

Shouldn't this be:
0 (or -1) for all streams (default), n>0 (or > -1) for the nth stream.
I guess it is at least possible that the user knows in advance which
streams the source will offer.
No?

Carl Eugen


It is very unlikely that this is known in advance. Also there is no reason
why you want to load more than a single variant at a time.
Note this are variants, not streams. Different variants bundle the same
streams with different resolutions.

Rainer

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


Re: [FFmpeg-devel] [PATCH 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Derek Buitenhuis
On 11/24/2017 8:09 PM, Paul B Mahol wrote:
> Do you have backtrace of this one?

Yes, but the alloc failure is not in lavfi:

my_posix_memalign:77 in libavutil/posixmemalign.c
av_malloc:89 in libavutil/mem.c
av_mallocz:240 in libavutil/mem.c
av_packet_alloc:53 in libavcodec/avpacket.c
av_bsf_alloc:106 in libavcodec/bsf.c
bsfs_init:224 in libavcodec/decode.c
avcodec_send_packet:655 in libavcodec/decode.c
decode:2241 in fftools/ffmpeg.c
decode_video:2385 in fftools/ffmpeg.c
process_input_packet:2626 in fftools/ffmpeg.c
process_input:4432 in fftools/ffmpeg.c
transcode_step:4552 in fftools/ffmpeg.c
transcode:4606 in fftools/ffmpeg.c
main:4812 in fftools/ffmpeg.c

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Nicolas George
Paul B Mahol (2017-11-24):
> But for what option instead was consensus?

I do not remember. That is your patch, therefore I think it is your
responsibility to re-read the discussion, make a choice that you think
will suit everybody, and re-submit the patch for final approval.

By the way, since the documentation was unclear, I was not able to
soundly review the code changes themselves. Please do not push without
re-submitting.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Paul B Mahol
On 11/24/17, Nicolas George  wrote:
> Paul B Mahol (2017-11-24):
>> But for what option instead was consensus?
>
> I do not remember. That is your patch, therefore I think it is your
> responsibility to re-read the discussion, make a choice that you think
> will suit everybody, and re-submit the patch for final approval.
>
> By the way, since the documentation was unclear, I was not able to
> soundly review the code changes themselves. Please do not push without
> re-submitting.

WTF you are very evil persona.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Nicolas George
Paul B Mahol (2017-11-24):
> WTF you are very evil persona.

I do not know what you mean, and please stop ad-hominem attacks.

I only want time to review the code while knowing what it is supposed to
do. So please re-submit your patch.

Regards, and EOT for me tonight,

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-24 Thread Paul B Mahol
On 11/24/17, Nicolas George  wrote:
> Paul B Mahol (2017-11-24):
>> WTF you are very evil persona.
>
> I do not know what you mean, and please stop ad-hominem attacks.
>
> I only want time to review the code while knowing what it is supposed to
> do. So please re-submit your patch.
>
> Regards, and EOT for me tonight,

You have very high opinion obout yourself and yours opinions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/vf_tile: add init_padding option

2017-11-24 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi  |  4 
 libavfilter/vf_tile.c | 12 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 76929e4db5..11ce0482c2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -14497,6 +14497,10 @@ is "black".
 @item overlap
 Set the number of frames to overlap when tiling several successive frames 
together.
 The value must be between @code{0} and @var{nb_frames - 1}.
+
+@item init_padding
+Set the number of input frames to initially consume before displaying first 
output frame.
+The value must be between @code{0} and @var{nb_frames - 1}.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c
index 7717ce12e7..c78fa611dd 100644
--- a/libavfilter/vf_tile.c
+++ b/libavfilter/vf_tile.c
@@ -38,6 +38,7 @@ typedef struct TileContext {
 unsigned margin;
 unsigned padding;
 unsigned overlap;
+unsigned init_padding;
 unsigned current;
 unsigned nb_frames;
 FFDrawContext draw;
@@ -62,6 +63,8 @@ static const AVOption tile_options[] = {
 { "color",   "set the color of the unused area", OFFSET(rgba_color), 
AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS },
 { "overlap", "set how many frames to overlap for each render", 
OFFSET(overlap),
 AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
+{ "init_padding", " set how many frames to initially pad", 
OFFSET(init_padding),
+AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
 { NULL }
 };
 
@@ -99,6 +102,13 @@ static av_cold int init(AVFilterContext *ctx)
 tile->overlap = tile->nb_frames - 1;
 }
 
+if (tile->init_padding >= tile->nb_frames) {
+av_log(ctx, AV_LOG_WARNING, "init_padding must be less than %d\n", 
tile->nb_frames);
+tile->current = 0;
+} else {
+tile->current = tile->init_padding;
+}
+
 return 0;
 }
 
@@ -201,7 +211,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*picref)
 tile->out_ref->height = outlink->h;
 
 /* fill surface once for margin/padding */
-if (tile->margin || tile->padding)
+if (tile->margin || tile->padding || tile->init_padding != 0)
 ff_fill_rectangle(&tile->draw, &tile->blank,
   tile->out_ref->data,
   tile->out_ref->linesize,
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH] hls demuxer: add option to defer parsing of variants

2017-11-24 Thread Michael Niedermayer
On Thu, Nov 23, 2017 at 11:20:10PM +0100, Rainer Hochecker wrote:
> ---
>  doc/demuxers.texi |   5 +
>  libavformat/hls.c | 299 
> --
>  2 files changed, 204 insertions(+), 100 deletions(-)

breaks fate-segment-mp4-to-ts
...
Output #0, framecrc, to 'pipe:':
Output file #0 does not contain any stream


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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/flacenc: support writing attached pictures

2017-11-24 Thread Michael Niedermayer
On Thu, Nov 23, 2017 at 07:08:42PM -0300, James Almer wrote:
> From: Rodger Combs 
> 
> Signed-off-by: James Almer 
> ---
> Should be good to commit now.
> 
>  libavformat/flacenc.c | 286 
> +++---
>  1 file changed, 250 insertions(+), 36 deletions(-)
> 
> diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
> index b894f9ef61..84da54a1df 100644
> --- a/libavformat/flacenc.c
> +++ b/libavformat/flacenc.c
> @@ -21,10 +21,13 @@
>  
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
>  #include "libavcodec/flac.h"
>  #include "avformat.h"
>  #include "avio_internal.h"
>  #include "flacenc.h"
> +#include "id3v2.h"
> +#include "internal.h"
>  #include "vorbiscomment.h"
>  #include "libavcodec/bytestream.h"
>  
> @@ -33,8 +36,16 @@ typedef struct FlacMuxerContext {
>  const AVClass *class;
>  int write_header;
>  
> +int audio_stream_idx;
> +AVPacket *pics;
> +int nb_pics, waiting_pics;
> +/* audio packets are queued here until we get all the attached pictures 
> */
> +AVPacketList *queue, *queue_end;
> +
>  /* updated streaminfo sent by the encoder at the end */
>  uint8_t *streaminfo;
> +
> +unsigned attached_types;
>  } FlacMuxerContext;
>  
>  static int flac_write_block_padding(AVIOContext *pb, unsigned int 
> n_padding_bytes,
> @@ -74,31 +85,157 @@ static int flac_write_block_comment(AVIOContext *pb, 
> AVDictionary **m,
>  return 0;
>  }
>  
> -static int flac_write_header(struct AVFormatContext *s)
> +static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
>  {
> -int ret;
> -int padding = s->metadata_header_padding;
> -AVCodecParameters *par = s->streams[0]->codecpar;
> -FlacMuxerContext *c   = s->priv_data;
> -
> -if (!c->write_header)
> +FlacMuxerContext *c = s->priv_data;
> +AVIOContext *pb = s->pb;
> +const AVPixFmtDescriptor *pixdesc;
> +const CodecMime *mime = ff_id3v2_mime_tags;
> +AVDictionaryEntry *e;
> +const char *mimetype = NULL, *desc = "";
> +const AVStream *st = s->streams[pkt->stream_index];
> +int i, mimelen, desclen, type = 0;
> +
> +if (!pkt->data)
>  return 0;
>  
> -if (s->nb_streams > 1) {
> -av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
> +while (mime->id != AV_CODEC_ID_NONE) {
> +if (mime->id == st->codecpar->codec_id) {
> +mimetype = mime->str;
> +break;
> +}
> +mime++;
> +}

> +if (!mimetype) {
> +av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
> +   "write an attached picture.\n", st->index);
> +return AVERROR(EINVAL);
> +}

This should print the name of the codec thats not supported, so the
user knows what is unsupported


[...]
> @@ -166,23 +347,56 @@ static int flac_write_trailer(struct AVFormatContext *s)
>  static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
>  {
>  FlacMuxerContext *c = s->priv_data;
> -uint8_t *streaminfo;
> -int streaminfo_size;
> +int ret;
>  
> -/* check for updated streaminfo */
> -streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
> - &streaminfo_size);
> -if (streaminfo && streaminfo_size == FLAC_STREAMINFO_SIZE) {
> -av_freep(&c->streaminfo);
> +if (pkt->stream_index == c->audio_stream_idx) {
> +if (c->waiting_pics) {
> +/* buffer audio packets until we get all the pictures */
> +AVPacketList *pktl = av_mallocz(sizeof(*pktl));

This kind of packet buffering code should not be duplicated per
muxer.
Also we already have buffering code that ensures packet interleaving.
can this not be done there ?
or am i missing something ?



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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 07:45:46PM +, Derek Buitenhuis wrote:
> I've had this kicking around for like 4 years, maybe it can be of use to some 
> people.
> I haven't done full scale fuzzing with this because laziness. I just 
> sometimes run it
> when I'm bored. It's not thread-safe, but it would be trivial to make it so.

Maybe integrating this in:
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

would make sense

That would run it automatically on ffmpeg master HEAD on powerfull hw



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Derek Buitenhuis
On 11/24/2017 11:35 PM, Michael Niedermayer wrote:
> Maybe integrating this in:
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> 
> would make sense
> 
> That would run it automatically on ffmpeg master HEAD on powerfull hw

Could make sense, yeah - wouldn't be that hard.

It would probably make an absolute ton of reports, since there are quite
a few unchecked allocs in FFmpeg... might be kinda spammy.

Also not sure how Google feels about using oss-fuzz to look for missing
NULL checks? Is there some set of guidelines?

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/flacenc: support writing attached pictures

2017-11-24 Thread James Almer
On 11/24/2017 8:27 PM, Michael Niedermayer wrote:
> On Thu, Nov 23, 2017 at 07:08:42PM -0300, James Almer wrote:
>> From: Rodger Combs 
>>
>> Signed-off-by: James Almer 
>> ---
>> Should be good to commit now.
>>
>>  libavformat/flacenc.c | 286 
>> +++---
>>  1 file changed, 250 insertions(+), 36 deletions(-)
>>
>> diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
>> index b894f9ef61..84da54a1df 100644
>> --- a/libavformat/flacenc.c
>> +++ b/libavformat/flacenc.c
>> @@ -21,10 +21,13 @@
>>  
>>  #include "libavutil/channel_layout.h"
>>  #include "libavutil/opt.h"
>> +#include "libavutil/pixdesc.h"
>>  #include "libavcodec/flac.h"
>>  #include "avformat.h"
>>  #include "avio_internal.h"
>>  #include "flacenc.h"
>> +#include "id3v2.h"
>> +#include "internal.h"
>>  #include "vorbiscomment.h"
>>  #include "libavcodec/bytestream.h"
>>  
>> @@ -33,8 +36,16 @@ typedef struct FlacMuxerContext {
>>  const AVClass *class;
>>  int write_header;
>>  
>> +int audio_stream_idx;
>> +AVPacket *pics;
>> +int nb_pics, waiting_pics;
>> +/* audio packets are queued here until we get all the attached pictures 
>> */
>> +AVPacketList *queue, *queue_end;
>> +
>>  /* updated streaminfo sent by the encoder at the end */
>>  uint8_t *streaminfo;
>> +
>> +unsigned attached_types;
>>  } FlacMuxerContext;
>>  
>>  static int flac_write_block_padding(AVIOContext *pb, unsigned int 
>> n_padding_bytes,
>> @@ -74,31 +85,157 @@ static int flac_write_block_comment(AVIOContext *pb, 
>> AVDictionary **m,
>>  return 0;
>>  }
>>  
>> -static int flac_write_header(struct AVFormatContext *s)
>> +static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
>>  {
>> -int ret;
>> -int padding = s->metadata_header_padding;
>> -AVCodecParameters *par = s->streams[0]->codecpar;
>> -FlacMuxerContext *c   = s->priv_data;
>> -
>> -if (!c->write_header)
>> +FlacMuxerContext *c = s->priv_data;
>> +AVIOContext *pb = s->pb;
>> +const AVPixFmtDescriptor *pixdesc;
>> +const CodecMime *mime = ff_id3v2_mime_tags;
>> +AVDictionaryEntry *e;
>> +const char *mimetype = NULL, *desc = "";
>> +const AVStream *st = s->streams[pkt->stream_index];
>> +int i, mimelen, desclen, type = 0;
>> +
>> +if (!pkt->data)
>>  return 0;
>>  
>> -if (s->nb_streams > 1) {
>> -av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
>> +while (mime->id != AV_CODEC_ID_NONE) {
>> +if (mime->id == st->codecpar->codec_id) {
>> +mimetype = mime->str;
>> +break;
>> +}
>> +mime++;
>> +}
> 
>> +if (!mimetype) {
>> +av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot 
>> "
>> +   "write an attached picture.\n", st->index);
>> +return AVERROR(EINVAL);
>> +}
> 
> This should print the name of the codec thats not supported, so the
> user knows what is unsupported
> 
> 
> [...]
>> @@ -166,23 +347,56 @@ static int flac_write_trailer(struct AVFormatContext 
>> *s)
>>  static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
>>  {
>>  FlacMuxerContext *c = s->priv_data;
>> -uint8_t *streaminfo;
>> -int streaminfo_size;
>> +int ret;
>>  
>> -/* check for updated streaminfo */
>> -streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
>> - &streaminfo_size);
>> -if (streaminfo && streaminfo_size == FLAC_STREAMINFO_SIZE) {
>> -av_freep(&c->streaminfo);
>> +if (pkt->stream_index == c->audio_stream_idx) {
>> +if (c->waiting_pics) {
>> +/* buffer audio packets until we get all the pictures */
>> +AVPacketList *pktl = av_mallocz(sizeof(*pktl));
> 
> This kind of packet buffering code should not be duplicated per
> muxer.

Having this code in three muxers isn't much of an issue. Also, I've been
waiting on some promised AVPacketList API but it never showed up.

> Also we already have buffering code that ensures packet interleaving.
> can this not be done there ?

What code would this be?

> or am i missing something ?

It's just buffering audio until the first video packet (AKA, cover art)
shows up. It then writes it, dumps all the buffered audio, then keeps
muxing audio normally (no more images are expected after that, and any
that shows up will be ignored).

> 
> 
> 
> [...]
> 
> 
> 
> ___
> 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 0/1][TOOL][HACK] Allocation NULL check fuzzer

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 11:41:06PM +, Derek Buitenhuis wrote:
> On 11/24/2017 11:35 PM, Michael Niedermayer wrote:
> > Maybe integrating this in:
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > 
> > would make sense
> > 
> > That would run it automatically on ffmpeg master HEAD on powerfull hw
> 
> Could make sense, yeah - wouldn't be that hard.
> 
> It would probably make an absolute ton of reports, since there are quite
> a few unchecked allocs in FFmpeg... might be kinda spammy.


> 
> Also not sure how Google feels about using oss-fuzz to look for missing
> NULL checks? Is there some set of guidelines?

I do not know that but i would be surprised if null dereferences tests
where unwelcome

oss-fuzz will already report null derferences and OOM conditions, as
well as undefined behavior. So in some sense various points on the map
surrounding this here are already tested for


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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH 1/2] h264_picture: Actually return error during alloc failure

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 07:27:12PM +, Derek Buitenhuis wrote:
> Fixes NULL dereference during alloc failure.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/h264_picture.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


[FFmpeg-devel] [PATCH 1/2] error_resilience: remove avpriv_atomic usage

2017-11-24 Thread Rostislav Pehlivanov
Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/error_resilience.c | 12 ++--
 libavcodec/error_resilience.h |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 0c7f29d171..6c7b4207af 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -852,20 +852,20 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
 mask &= ~VP_START;
 if (status & (ER_AC_ERROR | ER_AC_END)) {
 mask   &= ~(ER_AC_ERROR | ER_AC_END);
-avpriv_atomic_int_add_and_fetch(&s->error_count, start_i - end_i - 1);
+atomic_fetch_add(&s->error_count, start_i - end_i - 1);
 }
 if (status & (ER_DC_ERROR | ER_DC_END)) {
 mask   &= ~(ER_DC_ERROR | ER_DC_END);
-avpriv_atomic_int_add_and_fetch(&s->error_count, start_i - end_i - 1);
+atomic_fetch_add(&s->error_count, start_i - end_i - 1);
 }
 if (status & (ER_MV_ERROR | ER_MV_END)) {
 mask   &= ~(ER_MV_ERROR | ER_MV_END);
-avpriv_atomic_int_add_and_fetch(&s->error_count, start_i - end_i - 1);
+atomic_fetch_add(&s->error_count, start_i - end_i - 1);
 }
 
 if (status & ER_MB_ERROR) {
 s->error_occurred = 1;
-avpriv_atomic_int_set(&s->error_count, INT_MAX);
+atomic_store(&s->error_count, INT_MAX);
 }
 
 if (mask == ~0x7F) {
@@ -878,7 +878,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
 }
 
 if (end_i == s->mb_num)
-avpriv_atomic_int_set(&s->error_count, INT_MAX);
+atomic_store(&s->error_count, INT_MAX);
 else {
 s->error_status_table[end_xy] &= mask;
 s->error_status_table[end_xy] |= status;
@@ -893,7 +893,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
 prev_status &= ~ VP_START;
 if (prev_status != (ER_MV_END | ER_DC_END | ER_AC_END)) {
 s->error_occurred = 1;
-avpriv_atomic_int_set(&s->error_count, INT_MAX);
+atomic_store(&s->error_count, INT_MAX);
 }
 }
 }
diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 27c2008694..664a765659 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -20,6 +20,7 @@
 #define AVCODEC_ERROR_RESILIENCE_H
 
 #include 
+#include 
 
 #include "avcodec.h"
 #include "me_cmp.h"
@@ -60,7 +61,7 @@ typedef struct ERContext {
 ptrdiff_t mb_stride;
 ptrdiff_t b8_stride;
 
-volatile int error_count;
+atomic_int error_count;
 int error_occurred;
 uint8_t *error_status_table;
 uint8_t *er_temp_buffer;
-- 
2.15.0.417.g466bffb3ac

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


[FFmpeg-devel] [PATCH 2/2] lavc/utils.c: use C11 atomics for entangled thread handling

2017-11-24 Thread Rostislav Pehlivanov
Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/utils.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e50de6e89b..a3cd96ed2e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -56,6 +56,7 @@
 #include "version.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #if CONFIG_ICONV
@@ -114,7 +115,7 @@ static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) = 
NULL;
 
 
 volatile int ff_avcodec_locked;
-static int volatile entangled_thread_counter = 0;
+atomic_int volatile entangled_thread_counter = ATOMIC_VAR_INIT(0);
 static void *codec_mutex;
 static void *avformat_mutex;
 
@@ -1944,11 +1945,12 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
AVCodec *codec)
 return -1;
 }
 
-if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1) {
+atomic_fetch_add(&entangled_thread_counter, 1);
+if (atomic_load(&entangled_thread_counter) != 1) {
 av_log(log_ctx, AV_LOG_ERROR,
"Insufficient thread locking. At least %d threads are "
"calling avcodec_open2() at the same time right now.\n",
-   entangled_thread_counter);
+   atomic_load(&entangled_thread_counter));
 if (!lockmgr_cb)
 av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see 
av_lockmgr_register()\n");
 ff_avcodec_locked = 1;
@@ -1967,7 +1969,7 @@ int ff_unlock_avcodec(const AVCodec *codec)
 
 av_assert0(ff_avcodec_locked);
 ff_avcodec_locked = 0;
-avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1);
+atomic_fetch_add(&entangled_thread_counter, -1);
 if (lockmgr_cb) {
 if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE))
 return -1;
-- 
2.15.0.417.g466bffb3ac

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


Re: [FFmpeg-devel] [PATCH] lavu/pixfmt: Remove gap in the middle of enum AVPixelFormat

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 12:36:09PM +, Mark Thompson wrote:
> This was added for compatibility with libav, by leaving a space for
> formats added in libav to be merged.  Since that feature has been
> removed, we don't need a gap here.
> ---
> Should be applied before the unstable ABI period ends.
> 
> 
>  libavutil/pixfmt.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 4c530fe..e184a56 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -230,7 +230,7 @@ enum AVPixelFormat {
>   */
>  AV_PIX_FMT_CUDA,
>  
> -AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   
> X=unused/undefined
> +AV_PIX_FMT_0RGB,///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   
> X=unused/undefined
>  AV_PIX_FMT_RGB0,///< packed RGB 8:8:8, 32bpp, RGBXRGBX...   
> X=unused/undefined
>  AV_PIX_FMT_0BGR,///< packed BGR 8:8:8, 32bpp, XBGRXBGR...   
> X=unused/undefined
>  AV_PIX_FMT_BGR0,///< packed BGR 8:8:8, 32bpp, BGRXBGRX...   
> X=unused/undefined

LGTM

please bump the micro version so this is not totally stealthy happening
in the exact same version

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] lavf/mov: fix crash in mov_read_sidx

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 08:18:16AM -0800, John Stebbins wrote:
> Use correct index into streams
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thanks

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/utils.c: use C11 atomics for entangled thread handling

2017-11-24 Thread James Almer
On 11/24/2017 9:33 PM, Rostislav Pehlivanov wrote:
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavcodec/utils.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e50de6e89b..a3cd96ed2e 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -56,6 +56,7 @@
>  #include "version.h"
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #if CONFIG_ICONV
> @@ -114,7 +115,7 @@ static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) 
> = NULL;
>  
>  
>  volatile int ff_avcodec_locked;
> -static int volatile entangled_thread_counter = 0;
> +atomic_int volatile entangled_thread_counter = ATOMIC_VAR_INIT(0);

There's no need for volatile after making it atomic_int, and it should
remain static.

>  static void *codec_mutex;
>  static void *avformat_mutex;
>  
> @@ -1944,11 +1945,12 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
> AVCodec *codec)
>  return -1;
>  }
>  
> -if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1) {
> +atomic_fetch_add(&entangled_thread_counter, 1);
> +if (atomic_load(&entangled_thread_counter) != 1) {

Since the c11 function returns the value before the add instead of after
it, you can simplify this by doing

if (!atomic_fetch_add(&entangled_thread_counter, 1)) {

>  av_log(log_ctx, AV_LOG_ERROR,
> "Insufficient thread locking. At least %d threads are "
> "calling avcodec_open2() at the same time right now.\n",
> -   entangled_thread_counter);
> +   atomic_load(&entangled_thread_counter));
>  if (!lockmgr_cb)
>  av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please 
> see av_lockmgr_register()\n");
>  ff_avcodec_locked = 1;
> @@ -1967,7 +1969,7 @@ int ff_unlock_avcodec(const AVCodec *codec)
>  
>  av_assert0(ff_avcodec_locked);
>  ff_avcodec_locked = 0;
> -avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1);
> +atomic_fetch_add(&entangled_thread_counter, -1);
>  if (lockmgr_cb) {
>  if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE))
>  return -1;
> 

It might be worth for that matter testing to see if we can use laxer
memory access orders here and in ER, as by default the strictest one is
used (same as with the old avpriv_atomic functions).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 13/17] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

2017-11-24 Thread Michael Niedermayer
On Fri, Nov 24, 2017 at 12:51:30AM +, Mark Thompson wrote:
> This is needed by later hwaccel code to tell which encoding process was
> used for a particular frame, because hardware decoders may only support a
> subset of possible methods.
> ---
>  libavcodec/avcodec.h  | 6 ++
>  libavcodec/mjpegdec.c | 7 +++
>  2 files changed, 13 insertions(+)

this or a variant of this LGTM

thx

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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


  1   2   >