Re: [FFmpeg-devel] [PATCH] avutil/opencl: don't include config.h

2015-01-06 Thread Wei Gao
2015-01-06 12:56 GMT+08:00 James Almer :

> It's not an installed header. Use libavutil/avconfig.h instead.
>
> Signed-off-by: James Almer 
> ---
> Untested as i don't have an OpenCL SDK installed.
>
>  configure  | 2 +-
>  libavutil/opencl.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 50458ea..de6975c 100755
> --- a/configure
> +++ b/configure
> @@ -1629,6 +1629,7 @@ HAVE_LIST_CMDLINE="
>
>  HAVE_LIST_PUB="
>  bigendian
> +CL_cl_h
>  fast_unaligned
>  incompatible_libav_abi
>  "
> @@ -1640,7 +1641,6 @@ HEADERS_LIST="
>  asm_types_h
>  cdio_paranoia_h
>  cdio_paranoia_paranoia_h
> -CL_cl_h
>  dev_bktr_ioctl_bt848_h
>  dev_bktr_ioctl_meteor_h
>  dev_ic_bt8xx_h
> diff --git a/libavutil/opencl.h b/libavutil/opencl.h
> index 4655cba..67306da 100644
> --- a/libavutil/opencl.h
> +++ b/libavutil/opencl.h
> @@ -32,7 +32,7 @@
>  #ifndef LIBAVUTIL_OPENCL_H
>  #define LIBAVUTIL_OPENCL_H
>
> -#include "config.h"
> +#include "libavutil/avconfig.h"
>  #if HAVE_CL_CL_H
>  #include 
>  #else
> --
> 2.2.1
>
> looks good to me thanks

> ___
> 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 4/4] nvenc: Try and do interlaced encoding.

2015-01-06 Thread Agatha Hu

On 2015/1/6 15:36, Philip Langdale wrote:

Doesn't work.

Signed-off-by: Philip Langdale 
---
  libavcodec/libnvenc.c  | 7 +++
  libavcodec/libnvenc.h  | 3 +++
  libavcodec/nvencoder.c | 6 --
  3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libnvenc.c b/libavcodec/libnvenc.c
index 3c64234..83587a6 100644
--- a/libavcodec/libnvenc.c
+++ b/libavcodec/libnvenc.c
@@ -189,6 +189,9 @@ static av_cold int ff_libnvenc_init(AVCodecContext *avctx)
  if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
  nvenc_ctx->nvenc_cfg.enableRepeatSPSPPS = 0;

+if (avctx->flags & CODEC_FLAG_INTERLACED_DCT)
+nvenc_ctx->nvenc_cfg.interlaced = 1;
+
  // Allocate list of x264 options
  x264_argc = 0;
  x264_argv = av_calloc(255, sizeof(char*));
@@ -299,6 +302,10 @@ static int ff_libnvenc_encode(AVCodecContext *avctx, 
AVPacket *pkt, const AVFram
  nvenc_frame.width  = avctx->width;
  nvenc_frame.height = avctx->height;
  nvenc_frame.format = map_avpixfmt_bufferformat(avctx->pix_fmt);
+if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
+nvenc_frame.interlaced = 1;
+nvenc_frame.top_field_first = frame->top_field_first;
+}
  }

  // Setup output
diff --git a/libavcodec/libnvenc.h b/libavcodec/libnvenc.h
index 63b5d67..76cb379 100644
--- a/libavcodec/libnvenc.h
+++ b/libavcodec/libnvenc.h
@@ -91,6 +91,7 @@ typedef struct nvenc_cfg_t
  uint32_tsliceMode;
  uint32_tsliceModeData;
  uint32_tdisableDeblockingFilterIDC;
+boolinterlaced;

  // x264-style list of options
  char  **x264_paramv;
@@ -112,6 +113,8 @@ typedef struct nvenc_frame_t
  uint32_tframe_type;
  boolforce_idr;
  boolforce_intra;
+boolinterlaced;
+booltop_field_first;
  } nvenc_frame_t;

  /**
diff --git a/libavcodec/nvencoder.c b/libavcodec/nvencoder.c
index 2135f55..198ee09 100644
--- a/libavcodec/nvencoder.c
+++ b/libavcodec/nvencoder.c
@@ -478,7 +478,7 @@ static bool initialize(nvencoder_t *nvenc, nvenc_cfg_t 
*nvenc_cfg)
  nvenc->config.profileGUID   = map_profile(nvenc_cfg->profile);
  nvenc->config.gopLength = nvenc_cfg->gopLength;
  nvenc->config.frameIntervalP= 1 + nvenc_cfg->numBFrames;
-nvenc->config.frameFieldMode= 
NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME;
+nvenc->config.frameFieldMode= nvenc_cfg->interlaced ? 
NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD : NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME;
  nvenc->config.mvPrecision   = NV_ENC_MV_PRECISION_QUARTER_PEL;

  //NV_ENC_CODEC_CONFIG rate-control
@@ -563,7 +563,9 @@ static bool encode_frame(nvencoder_t *nvenc, nvenc_frame_t 
*nvenc_frame, bool *o
  pic_params.inputBuffer = nvenc->i_buffer[nvenc->current_i % 
MAX_BUFFERS];
  pic_params.outputBitstream = nvenc->o_buffer[nvenc->current_o % 
MAX_BUFFERS];
  pic_params.bufferFmt   = nvenc->buffer_fmt;
-pic_params.pictureStruct   = NV_ENC_PIC_STRUCT_FRAME;
+pic_params.pictureStruct   = nvenc_frame->interlaced ?
+ nvenc_frame->top_field_first ? 
NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM : NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP :
+ NV_ENC_PIC_STRUCT_FRAME;
  pic_params.frameIdx= nvenc_frame->frame_idx;
  if (nvenc_frame->force_idr)
  pic_params.encodePicFlags |= NV_ENC_PIC_FLAG_FORCEIDR;



OK let me take a look
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/opencl: don't include config.h

2015-01-06 Thread Michael Niedermayer
On Tue, Jan 06, 2015 at 01:56:01AM -0300, James Almer wrote:
> It's not an installed header. Use libavutil/avconfig.h instead.

assuming noone objects to this "hack" ... ugly but it should fix the
build so ok

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

Those who are best at talking, realize last or never when they are wrong.


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/5] cmdutils: add insert_timeline_graph()

2015-01-06 Thread Clément Bœsch
On Tue, Jan 06, 2015 at 10:06:15PM +0100, wm4 wrote:
> On Tue, 6 Jan 2015 20:40:51 +0100
> Clément Bœsch  wrote:
> 
> > On Tue, Jan 06, 2015 at 08:28:48PM +0100, wm4 wrote:
> > > On Tue,  6 Jan 2015 18:09:58 +0100
> > > Clément Bœsch  wrote:
> > > 
> > > > From: Clément Bœsch 
> > > > 
> > > > This function will be used in the following commits in ffmpeg and
> > > > ffplay.
> > > > ---
> > > >  cmdutils.c | 170 
> > > > +
> > > >  cmdutils.h |  12 +
> > > >  2 files changed, 182 insertions(+)
> > > > 
> > > > diff --git a/cmdutils.c b/cmdutils.c
> > > > index b35180e..0e22e57 100644
> > > > --- a/cmdutils.c
> > > > +++ b/cmdutils.c
> > > > @@ -31,7 +31,9 @@
> > > >  
> > > >  #include "config.h"
> > > >  #include "compat/va_copy.h"
> > > > +#include "libavcodec/bytestream.h"
> > > >  #include "libavformat/avformat.h"
> > > > +#include "libavformat/isom.h"
> > > >  #include "libavfilter/avfilter.h"
> > > >  #include "libavdevice/avdevice.h"
> > > >  #include "libavresample/avresample.h"
> > [...]
> > > > +/**
> > > > + * Get the MOV timeline from the stream side data, construct a 
> > > > libavfilter
> > > > + * filtergraph, and insert it after the last filter.
> > > > + *
> > > > + * @param st  the stream with the timeline
> > > > + * @param last_filter pointer to last filter to stick the filtergraph 
> > > > (will be updated)
> > > > + * @param start_time  initial timestamp offset in AV_TIME_BASE_Q time 
> > > > base
> > > > + * @param reverse if set, prepend the timeline filtergraph instead 
> > > > of appending it
> > > > + */
> > > > +int insert_timeline_graph(const AVStream *st, AVFilterContext 
> > > > **last_filter,
> > > > +  int64_t start_time, int reverse);
> > > > +
> > > >  #endif /* CMDUTILS_H */
> > > 
> > > So libavformat exports the raw MOV atom, and all tools ffmpeg.c uses to
> > > parse it are private libavformat/libavcodec API?? That seems very
> > > unfair to the API user.
> > 
> > libavformat/isom.h is needed only for MOVElst, which is the following:
> > 
> > typedef struct MOVElst {
> > int64_t duration;
> > int64_t time;
> > float rate;
> > } MOVElst;
> > 
> > About the bytestream, that's kind of the same issue you will have for 
> > parsing
> > kind of any bytestream, I don't think it is really unfair since most 
> > multimedia
> > app will probably already have that.
> > 
> 
> Why not just wrap this struct?

Just because it's way less API and ABI maintenance.

Would you really prefer that I add a MOV/MP4 field to AVFormatContext,
with a public header for the elst structures, which will possibly change
anytime soon? Changes in that structure already happened with the 32 vs 64
fields, and might happen again because it's still kind of experimental -
remember someone talking about adding a "loop" feature into this the other
day? I'm not exactly willing to change these structures all the time.

I believe adding a field to AVFormatContext should be an abstract enough
and well thought API for time lines. Right now, this only support MOV/MP4.
If we happen to support that also for MKV, then we can start thinking
about such API. Right now, I took the less risky approach, that is
exporting the atom verbatim and let the end user deal with it.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/5] cmdutils: add insert_timeline_graph()

2015-01-06 Thread wm4
On Tue, 6 Jan 2015 20:40:51 +0100
Clément Bœsch  wrote:

> On Tue, Jan 06, 2015 at 08:28:48PM +0100, wm4 wrote:
> > On Tue,  6 Jan 2015 18:09:58 +0100
> > Clément Bœsch  wrote:
> > 
> > > From: Clément Bœsch 
> > > 
> > > This function will be used in the following commits in ffmpeg and
> > > ffplay.
> > > ---
> > >  cmdutils.c | 170 
> > > +
> > >  cmdutils.h |  12 +
> > >  2 files changed, 182 insertions(+)
> > > 
> > > diff --git a/cmdutils.c b/cmdutils.c
> > > index b35180e..0e22e57 100644
> > > --- a/cmdutils.c
> > > +++ b/cmdutils.c
> > > @@ -31,7 +31,9 @@
> > >  
> > >  #include "config.h"
> > >  #include "compat/va_copy.h"
> > > +#include "libavcodec/bytestream.h"
> > >  #include "libavformat/avformat.h"
> > > +#include "libavformat/isom.h"
> > >  #include "libavfilter/avfilter.h"
> > >  #include "libavdevice/avdevice.h"
> > >  #include "libavresample/avresample.h"
> [...]
> > > +/**
> > > + * Get the MOV timeline from the stream side data, construct a 
> > > libavfilter
> > > + * filtergraph, and insert it after the last filter.
> > > + *
> > > + * @param st  the stream with the timeline
> > > + * @param last_filter pointer to last filter to stick the filtergraph 
> > > (will be updated)
> > > + * @param start_time  initial timestamp offset in AV_TIME_BASE_Q time 
> > > base
> > > + * @param reverse if set, prepend the timeline filtergraph instead 
> > > of appending it
> > > + */
> > > +int insert_timeline_graph(const AVStream *st, AVFilterContext 
> > > **last_filter,
> > > +  int64_t start_time, int reverse);
> > > +
> > >  #endif /* CMDUTILS_H */
> > 
> > So libavformat exports the raw MOV atom, and all tools ffmpeg.c uses to
> > parse it are private libavformat/libavcodec API?? That seems very
> > unfair to the API user.
> 
> libavformat/isom.h is needed only for MOVElst, which is the following:
> 
> typedef struct MOVElst {
> int64_t duration;
> int64_t time;
> float rate;
> } MOVElst;
> 
> About the bytestream, that's kind of the same issue you will have for parsing
> kind of any bytestream, I don't think it is really unfair since most 
> multimedia
> app will probably already have that.
> 

Why not just wrap this struct?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/5] cmdutils: add insert_timeline_graph()

2015-01-06 Thread Clément Bœsch
On Tue, Jan 06, 2015 at 08:28:48PM +0100, wm4 wrote:
> On Tue,  6 Jan 2015 18:09:58 +0100
> Clément Bœsch  wrote:
> 
> > From: Clément Bœsch 
> > 
> > This function will be used in the following commits in ffmpeg and
> > ffplay.
> > ---
> >  cmdutils.c | 170 
> > +
> >  cmdutils.h |  12 +
> >  2 files changed, 182 insertions(+)
> > 
> > diff --git a/cmdutils.c b/cmdutils.c
> > index b35180e..0e22e57 100644
> > --- a/cmdutils.c
> > +++ b/cmdutils.c
> > @@ -31,7 +31,9 @@
> >  
> >  #include "config.h"
> >  #include "compat/va_copy.h"
> > +#include "libavcodec/bytestream.h"
> >  #include "libavformat/avformat.h"
> > +#include "libavformat/isom.h"
> >  #include "libavfilter/avfilter.h"
> >  #include "libavdevice/avdevice.h"
> >  #include "libavresample/avresample.h"
[...]
> > +/**
> > + * Get the MOV timeline from the stream side data, construct a libavfilter
> > + * filtergraph, and insert it after the last filter.
> > + *
> > + * @param st  the stream with the timeline
> > + * @param last_filter pointer to last filter to stick the filtergraph 
> > (will be updated)
> > + * @param start_time  initial timestamp offset in AV_TIME_BASE_Q time base
> > + * @param reverse if set, prepend the timeline filtergraph instead of 
> > appending it
> > + */
> > +int insert_timeline_graph(const AVStream *st, AVFilterContext 
> > **last_filter,
> > +  int64_t start_time, int reverse);
> > +
> >  #endif /* CMDUTILS_H */
> 
> So libavformat exports the raw MOV atom, and all tools ffmpeg.c uses to
> parse it are private libavformat/libavcodec API?? That seems very
> unfair to the API user.

libavformat/isom.h is needed only for MOVElst, which is the following:

typedef struct MOVElst {
int64_t duration;
int64_t time;
float rate;
} MOVElst;

About the bytestream, that's kind of the same issue you will have for parsing
kind of any bytestream, I don't think it is really unfair since most multimedia
app will probably already have that.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/5] cmdutils: add insert_timeline_graph()

2015-01-06 Thread wm4
On Tue,  6 Jan 2015 18:09:58 +0100
Clément Bœsch  wrote:

> From: Clément Bœsch 
> 
> This function will be used in the following commits in ffmpeg and
> ffplay.
> ---
>  cmdutils.c | 170 
> +
>  cmdutils.h |  12 +
>  2 files changed, 182 insertions(+)
> 
> diff --git a/cmdutils.c b/cmdutils.c
> index b35180e..0e22e57 100644
> --- a/cmdutils.c
> +++ b/cmdutils.c
> @@ -31,7 +31,9 @@
>  
>  #include "config.h"
>  #include "compat/va_copy.h"
> +#include "libavcodec/bytestream.h"
>  #include "libavformat/avformat.h"
> +#include "libavformat/isom.h"
>  #include "libavfilter/avfilter.h"
>  #include "libavdevice/avdevice.h"
>  #include "libavresample/avresample.h"
> @@ -2252,3 +2254,171 @@ int show_sinks(void *optctx, const char *opt, const 
> char *arg)
>  return ret;
>  }
>  #endif
> +
> +static int parse_elst(MOVElst **ret, const uint8_t *buf, int size)
> +{
> +GetByteContext gb;
> +int i, edit_count, version;
> +MOVElst *elst_data;
> +
> +bytestream2_init(&gb, buf, size);
> +
> +version = bytestream2_get_byte(&gb);
> +bytestream2_skip(&gb, 3); /* flags */
> +edit_count = bytestream2_get_be32(&gb);
> +
> +if (!edit_count)
> +return 0;
> +
> +elst_data = av_malloc_array(edit_count, sizeof(*elst_data));
> +if (!elst_data)
> +return AVERROR(ENOMEM);
> +
> +for (i = 0; i < edit_count && bytestream2_get_bytes_left(&gb) > 0; i++) {
> +MOVElst *e = &elst_data[i];
> +
> +if (version == 1) {
> +e->duration = bytestream2_get_be64(&gb);
> +e->time = bytestream2_get_be64(&gb);
> +} else {
> +e->duration = bytestream2_get_be32(&gb);
> +e->time = (int32_t)bytestream2_get_be32(&gb);
> +}
> +e->rate = bytestream2_get_be32(&gb) / 65536.0;
> +}
> +
> +*ret = elst_data;
> +return i;
> +}
> +
> +static int get_elst_lavfi_graph_str(AVBPrint *bp, const AVStream *st, 
> int64_t start_time)
> +{
> +int i, elst_count, size;
> +AVBPrint select;
> +AVBPrint setpts;
> +MOVElst *elst;
> +AVRational tb;
> +
> +const uint8_t *buf = av_stream_get_side_data(st, 
> AV_PKT_DATA_MOV_TIMELINE, &size);
> +if (!buf || size <= 4)
> +return 0;
> +
> +tb = av_make_q(1, AV_RB32(buf));
> +
> +elst_count = parse_elst(&elst, buf + 4, size - 4);
> +if (elst_count <= 0)
> +return elst_count;
> +
> +av_bprint_init(bp,  0, AV_BPRINT_SIZE_UNLIMITED);
> +av_bprint_init(&select, 0, AV_BPRINT_SIZE_UNLIMITED);
> +av_bprint_init(&setpts, 0, AV_BPRINT_SIZE_UNLIMITED);
> +
> +for (i = 0; i < elst_count; i++) {
> +int64_t gap;
> +const MOVElst *segment = &elst[i];
> +const MOVElst *next= i < elst_count - 1 ? &elst[i + 1] : NULL;
> +const MOVElst *prev= i > 0  ? &elst[i - 1] : NULL;
> +int64_t rescaled_start = av_rescale_q(segment->time, tb, 
> st->time_base);
> +int64_t end = segment->duration ? segment->time + segment->duration 
> : -1;
> +
> +if (!segment->duration && next)
> +end = next->time;
> +
> +if (select.str[0]) {
> +av_bprintf(&select, "+");
> +} if (end == -1) {
> +av_bprintf(&select, "gte(pts,%"PRId64")", rescaled_start);
> +} else {
> +const int64_t rescaled_end = av_rescale_q(end, tb, 
> st->time_base);
> +av_bprintf(&select, "between(pts,%"PRId64",%"PRId64"-1)",
> +   rescaled_start, rescaled_end);
> +}
> +
> +if (segment->time == -1)
> +/* XXX: we are supposed to insert initial silence/emptiness here 
> */
> +gap = segment->duration;
> +else if (prev)
> +gap = segment->time - prev->time - prev->duration;
> +else
> +gap = segment->time;
> +gap *= segment->rate;
> +
> +if (gap) {
> +if (!*setpts.str)
> +av_bprintf(&setpts, "PTS");
> +gap = av_rescale_q(gap, tb, st->time_base);
> +av_bprintf(&setpts, "-if(gte(PTS,%"PRId64"),%"PRId64",0)",
> +   segment->time, gap);
> +}
> +}
> +
> +av_freep(&elst);
> +
> +if (select.str[0] && av_bprint_is_complete(&select) && 
> av_bprint_is_complete(&setpts)) {
> +const char *tstr = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? "a" 
> : "";
> +int64_t rescaled_start_time = start_time == AV_NOPTS_VALUE ? 0 : 
> av_rescale_q(start_time, AV_TIME_BASE_Q, st->time_base);
> +
> +av_bprintf(bp, "[tl_in] ");
> +
> +/* make sure the following filters will not take into account the PTS
> + * shift that can occur with ffmpeg (-ss) */
> +if (rescaled_start_time)
> +av_bprintf(bp, "%ssetpts=PTS+%"PRId64", ", tstr, 
> rescaled_start_time);
> +
> +/* select the time ranges
> + * FIXME: aselect

Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: export the full UMID as metadata

2015-01-06 Thread Mark Reid
On Tue, Jan 6, 2015 at 12:03 AM, tim nicholson <
nichot20-at-yahoo@ffmpeg.org> wrote:

> On 05/01/15 20:41, Mark Reid wrote:
> > Hi,
> > This patch exports the full umid of packages as metadata. ffmpeg
> currently
> > only exports the material number portion of the umid.
> >
> > The new format is
> >---
> > example:
> >060a2b340101010101010f00-13-00-53dc416b9a770251060e2b347f7f2a80
> >
>
> I think this is a good idea, but if we are going to make the change can
> we make the exported format be SMPTE330 compliant? Annex C (normative)
> states:-
>
> "By default, the hexadecimal representation should be preceded by the
> identifier ‘0x’. This default method of identification will result in 66
> hexadecimal characters to represent a basic UMID as follows:
> 0x060A2B340101010501010D13 ... etc.
> The hexadecimal letters should be encoded as upper case (A...F)."
>
>
sounds like the right thing to do to me.

so if I understand correctly
060a2b340101010101010f00-13-00-53dc416b9a770251060e2b347f7f2a80

should be just
0x060A2B340101010101010F00130053DC416B9A770251060E2B347F7F2A80

easy enough, I'll submit a new patch doing that instead.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: read project_name metadata

2015-01-06 Thread Clément Bœsch
On Tue, Jan 06, 2015 at 10:06:13AM -0800, Mark Reid wrote:
> On Mon, Jan 5, 2015 at 11:26 PM, Clément Bœsch  wrote:
> 
> > On Mon, Jan 05, 2015 at 04:53:05PM -0800, Mark Reid wrote:
> > > Hi,
> > > MXF files generated by Media Composer or LibMXF can contain a
> > > project name property in the Preface. Lots of existing samples have them.
> > >
> > > http://samples.ffmpeg.org/MXF/issue2160/PW0805A0V01.4C5B5636.EFA330.mxf
> > > project_name: DNX145 PW Test
> > >
> > >
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3450/WriteAvidMXFgenerated/5502_0010_v1.mxf
> > > project_name: Rombus
> > >
> > >
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3100/1sec_mxf_test_Video5270C795.mxf
> > > project_name: NVB_DOOD
> > >
> > > i can also provide more samples if needed.
> > >
> > > ---
> > >  libavformat/mxfdec.c | 15 +++
> > >  1 file changed, 15 insertions(+)
> > >
> > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > > index 4715169..23d9c73 100644
> > > --- a/libavformat/mxfdec.c
> > > +++ b/libavformat/mxfdec.c
> > > @@ -279,6 +279,7 @@ static const uint8_t mxf_encrypted_triplet_key[]
> >= { 0x06,0x0e,0x2b,0x
> > >  static const uint8_t mxf_encrypted_essence_container[] = {
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00
> > };
> > >  static const uint8_t mxf_random_index_pack_key[]   = {
> > 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00
> > };
> > >  static const uint8_t mxf_sony_mpeg4_extradata[]= {
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00
> > };
> > > +static const uint8_t mxf_avid_project_name[]   = {
> > 0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf
> > };
> > >
> > >  #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
> > >
> > > @@ -2087,6 +2088,19 @@ static int mxf_read_identification_metadata(void
> > *arg, AVIOContext *pb, int tag,
> > >  return 0;
> > >  }
> > >
> > > +static int mxf_read_preface_metadata(void *arg, AVIOContext *pb, int
> > tag, int size, UID uid, int64_t klv_offset)
> > > +{
> > > +MXFContext *mxf = arg;
> > > +AVFormatContext *s = mxf->fc;
> > > +int ret;
> > > +char *str = NULL;
> > > +
> > > +if (tag >= 0x8000 && (IS_KLV_KEY(uid, mxf_avid_project_name))) {
> > > +SET_STR_METADATA(pb, "project_name", str);
> > > +}
> > > +return 0;
> > > +}
> > > +
> >
> > Would it make sense to use "title"? (That's the internal metadata name we
> > use to re-map automatically in a bunch of other formats).
> >
> >
> In that context, I think it would make more sense for
> "material_package_name" to be renamed to "title" instead.

In that case, you can ignore my comment.

> I could do that in another patch?
> 

No real opinion, except that changing an existing key might break stuff so
I wouldn't suggest that.

> This "project_name" is the name of the Avid Media Composer Project (or
> Workspace, Session etc) the mxf is suppose to belong to or was created in.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: read project_name metadata

2015-01-06 Thread Mark Reid
On Mon, Jan 5, 2015 at 11:26 PM, Clément Bœsch  wrote:

> On Mon, Jan 05, 2015 at 04:53:05PM -0800, Mark Reid wrote:
> > Hi,
> > MXF files generated by Media Composer or LibMXF can contain a
> > project name property in the Preface. Lots of existing samples have them.
> >
> > http://samples.ffmpeg.org/MXF/issue2160/PW0805A0V01.4C5B5636.EFA330.mxf
> > project_name: DNX145 PW Test
> >
> >
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3450/WriteAvidMXFgenerated/5502_0010_v1.mxf
> > project_name: Rombus
> >
> >
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3100/1sec_mxf_test_Video5270C795.mxf
> > project_name: NVB_DOOD
> >
> > i can also provide more samples if needed.
> >
> > ---
> >  libavformat/mxfdec.c | 15 +++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > index 4715169..23d9c73 100644
> > --- a/libavformat/mxfdec.c
> > +++ b/libavformat/mxfdec.c
> > @@ -279,6 +279,7 @@ static const uint8_t mxf_encrypted_triplet_key[]
>= { 0x06,0x0e,0x2b,0x
> >  static const uint8_t mxf_encrypted_essence_container[] = {
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00
> };
> >  static const uint8_t mxf_random_index_pack_key[]   = {
> 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00
> };
> >  static const uint8_t mxf_sony_mpeg4_extradata[]= {
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00
> };
> > +static const uint8_t mxf_avid_project_name[]   = {
> 0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf
> };
> >
> >  #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
> >
> > @@ -2087,6 +2088,19 @@ static int mxf_read_identification_metadata(void
> *arg, AVIOContext *pb, int tag,
> >  return 0;
> >  }
> >
> > +static int mxf_read_preface_metadata(void *arg, AVIOContext *pb, int
> tag, int size, UID uid, int64_t klv_offset)
> > +{
> > +MXFContext *mxf = arg;
> > +AVFormatContext *s = mxf->fc;
> > +int ret;
> > +char *str = NULL;
> > +
> > +if (tag >= 0x8000 && (IS_KLV_KEY(uid, mxf_avid_project_name))) {
> > +SET_STR_METADATA(pb, "project_name", str);
> > +}
> > +return 0;
> > +}
> > +
>
> Would it make sense to use "title"? (That's the internal metadata name we
> use to re-map automatically in a bunch of other formats).
>
>
In that context, I think it would make more sense for
"material_package_name" to be renamed to "title" instead. I could do that
in another patch?

This "project_name" is the name of the Avid Media Composer Project (or
Workspace, Session etc) the mxf is suppose to belong to or was created in.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/5] ffplay: add support for MOV edit lists

2015-01-06 Thread Clément Bœsch
From: Clément Bœsch 

---
 doc/ffplay.texi |  3 +++
 ffplay.c| 25 ++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index 45731a2..126c19b 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -174,6 +174,9 @@ input as soon as possible. Enabled by default for realtime 
streams, where data
 may be dropped if not read in time. Use this option to enable infinite buffers
 for all inputs, use @option{-noinfbuf} to disable it.
 
+@item -honor_timeline
+Enable support for format timelines such as MOV/MP4 edit lists. Enabled by
+default, use @option{-nohonor_timeline} to disable it.
 @end table
 
 @section While playing
diff --git a/ffplay.c b/ffplay.c
index 72ec35d..0e70f25 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -342,6 +342,7 @@ static int nb_vfilters = 0;
 static char *afilters = NULL;
 #endif
 static int autorotate = 1;
+static int honor_timeline = 1;
 
 /* current context */
 static int is_full_screen;
@@ -2022,6 +2023,10 @@ static int configure_video_filters(AVFilterGraph *graph, 
VideoState *is, const c
 }
 }
 
+if (honor_timeline &&
+(ret = insert_timeline_graph(is->video_st, &last_filter, 0, 1)) < 0)
+goto fail;
+
 if ((ret = configure_filtergraph(graph, vfilters, filt_src, last_filter)) 
< 0)
 goto fail;
 
@@ -2038,7 +2043,7 @@ static int configure_audio_filters(VideoState *is, const 
char *afilters, int for
 int sample_rates[2] = { 0, -1 };
 int64_t channel_layouts[2] = { 0, -1 };
 int channels[2] = { 0, -1 };
-AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
+AVFilterContext *filt_asrc = NULL, *filt_asink = NULL, *last_filter = NULL;
 char aresample_swr_opts[512] = "";
 AVDictionaryEntry *e = NULL;
 char asrc_args[256];
@@ -2095,8 +2100,14 @@ static int configure_audio_filters(VideoState *is, const 
char *afilters, int for
 goto end;
 }
 
+last_filter = filt_asink;
 
-if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, 
filt_asink)) < 0)
+// XXX: audio stream can be NULL here, why?
+if (honor_timeline && is->audio_st &&
+(ret = insert_timeline_graph(is->audio_st, &last_filter, 0, 1)) < 0)
+goto end;
+
+if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, 
last_filter)) < 0)
 goto end;
 
 is->in_audio_filter  = filt_asrc;
@@ -2880,7 +2891,7 @@ static int read_thread(void *arg)
 AVDictionary **opts;
 int orig_nb_streams;
 SDL_mutex *wait_mutex = SDL_CreateMutex();
-int scan_all_pmts_set = 0;
+int scan_all_pmts_set = 0, ignore_editlist_set = 0;
 
 memset(st_index, -1, sizeof(st_index));
 is->last_video_stream = is->video_stream = -1;
@@ -2894,6 +2905,11 @@ static int read_thread(void *arg)
 av_dict_set(&format_opts, "scan_all_pmts", "1", 
AV_DICT_DONT_OVERWRITE);
 scan_all_pmts_set = 1;
 }
+if (CONFIG_AVFILTER && honor_timeline &&
+!av_dict_get(format_opts, "ignore_editlist", NULL, 
AV_DICT_MATCH_CASE)) {
+av_dict_set(&format_opts, "ignore_editlist", "export", 
AV_DICT_DONT_OVERWRITE);
+ignore_editlist_set = 1;
+}
 err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts);
 if (err < 0) {
 print_error(is->filename, err);
@@ -2902,6 +2918,8 @@ static int read_thread(void *arg)
 }
 if (scan_all_pmts_set)
 av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
+if (ignore_editlist_set)
+av_dict_set(&format_opts, "ignore_editlist", NULL, AV_DICT_MATCH_CASE);
 
 if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
 av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
@@ -3713,6 +3731,7 @@ static const OptionDef options[] = {
 { "scodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, 
"force subtitle decoder", "decoder_name" },
 { "vcodec", HAS_ARG | OPT_STRING | OPT_EXPERT, {&video_codec_name }, 
"force video decoder","decoder_name" },
 { "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", 
"" },
+{ "honor_timeline", OPT_BOOL | OPT_EXPERT, { &honor_timeline }, "honor 
timelines", "" },
 { NULL, },
 };
 
-- 
2.2.1

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


[FFmpeg-devel] [PATCH] ffserver: Use av_malloc_array()

2015-01-06 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 ffserver.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index c4cf390..19d0b25 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2810,11 +2810,9 @@ static int prepare_sdp_description(FFServerStream 
*stream, uint8_t **pbuffer,
 snprintf(avc->filename, 1024, "rtp://0.0.0.0");
 }
 
-if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
-!(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams
+if (!(avc->streams = av_malloc_array(avc->nb_streams, 
sizeof(*avc->streams
 goto sdp_done;
-if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
-!(avs = av_malloc(avc->nb_streams * sizeof(*avs
+if (!(avs = av_malloc_array(avc->nb_streams, sizeof(*avs
 goto sdp_done;
 
 for(i = 0; i < stream->nb_streams; i++) {
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH 5/5] Changelog: mention edit list support

2015-01-06 Thread Clément Bœsch
From: Clément Bœsch 

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

diff --git a/Changelog b/Changelog
index 4575e8b..43998cc 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version :
 - tblend filter
 - cropdetect support for non 8bpp, absolute (if limit >= 1) and relative (if 
limit < 1.0) threshold
 - Camellia symmetric block cipher
+- MOV/MP4 edit list support in ffmpeg and ffplay
 
 
 version 2.5:
-- 
2.2.1

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


[FFmpeg-devel] [PATCH 3/5] ffmpeg: add support for MOV edit lists

2015-01-06 Thread Clément Bœsch
From: Clément Bœsch 

---
 doc/ffmpeg.texi |3 +
 ffmpeg.h|2 +
 ffmpeg_filter.c |   32 +-
 ffmpeg_opt.c|   13 +-
 tests/ref/fate/gsm-toast| 1000 +++
 tests/ref/fate/pcm_s16be-stereo |2 +-
 tests/ref/fate/quickdraw|4 +-
 7 files changed, 540 insertions(+), 516 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 396c623..693ded5 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1189,6 +1189,9 @@ Discard all frames excepts keyframes.
 Discard all frames.
 @end table
 
+@item -honor_timeline (@emph{input})
+Enable support for format timelines such as MOV/MP4 edit lists. Enabled by
+default, use @option{-nohonor_timeline} to disable it.
 @end table
 
 As a special exception, you can use a bitmap subtitle stream as input: it
diff --git a/ffmpeg.h b/ffmpeg.h
index 0ad1e37..06e81be 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -111,6 +111,7 @@ typedef struct OptionsContext {
 int64_t input_ts_offset;
 int rate_emu;
 int accurate_seek;
+int honor_timeline;
 
 SpecifierOpt *ts_scale;
 intnb_ts_scale;
@@ -342,6 +343,7 @@ typedef struct InputFile {
 int nb_streams_warn;  /* number of streams that the user was warned of */
 int rate_emu;
 int accurate_seek;
+int honor_timeline;
 
 #if HAVE_PTHREADS
 AVThreadMessageQueue *in_thread_queue;
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 264840b..eb6cf27 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -637,7 +637,10 @@ static int configure_input_video_filter(FilterGraph *fg, 
InputFilter *ifilter,
 AVBPrint args;
 char name[255];
 int ret, pad_idx = 0;
-int64_t tsoffset = 0;
+
+int64_t tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
+if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
+tsoffset += f->ctx->start_time;
 
 if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
 av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio 
input\n");
@@ -676,6 +679,10 @@ static int configure_input_video_filter(FilterGraph *fg, 
InputFilter *ifilter,
 return ret;
 last_filter = ifilter->filter;
 
+if (f->honor_timeline &&
+(ret = insert_timeline_graph(ist->st, &last_filter, tsoffset, 0)) < 0)
+return ret;
+
 if (ist->framerate.num) {
 AVFilterContext *setpts;
 
@@ -712,11 +719,8 @@ static int configure_input_video_filter(FilterGraph *fg, 
InputFilter *ifilter,
 
 snprintf(name, sizeof(name), "trim for input stream %d:%d",
  ist->file_index, ist->st->index);
-if (copy_ts) {
-tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
-if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
-tsoffset += f->ctx->start_time;
-}
+if (!copy_ts)
+tsoffset = 0;
 ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) 
?
   AV_NOPTS_VALUE : tsoffset, f->recording_time,
   &last_filter, &pad_idx, name);
@@ -738,7 +742,10 @@ static int configure_input_audio_filter(FilterGraph *fg, 
InputFilter *ifilter,
 AVBPrint args;
 char name[255];
 int ret, pad_idx = 0;
-int64_t tsoffset = 0;
+
+int64_t tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
+if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
+tsoffset += f->ctx->start_time;
 
 if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) {
 av_log(NULL, AV_LOG_ERROR, "Cannot connect audio filter to non audio 
input\n");
@@ -764,6 +771,10 @@ static int configure_input_audio_filter(FilterGraph *fg, 
InputFilter *ifilter,
 return ret;
 last_filter = ifilter->filter;
 
+if (f->honor_timeline &&
+(ret = insert_timeline_graph(ist->st, &last_filter, tsoffset, 0)) < 0)
+return ret;
+
 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do {  
   \
 AVFilterContext *filt_ctx;  \
 \
@@ -821,11 +832,8 @@ static int configure_input_audio_filter(FilterGraph *fg, 
InputFilter *ifilter,
 
 snprintf(name, sizeof(name), "trim for input stream %d:%d",
  ist->file_index, ist->st->index);
-if (copy_ts) {
-tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
-if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
-tsoffset += f->ctx->start_time;
-}
+if (!copy_ts)
+tsoffset = 0;
 ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) 
?
   AV_NOPTS_VALUE : tsoffset, f->recording_time,
   &last_filter, &pad_idx, name);
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ac93eb5..f1a20fa 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@

[FFmpeg-devel] [PATCH 2/5] cmdutils: add insert_timeline_graph()

2015-01-06 Thread Clément Bœsch
From: Clément Bœsch 

This function will be used in the following commits in ffmpeg and
ffplay.
---
 cmdutils.c | 170 +
 cmdutils.h |  12 +
 2 files changed, 182 insertions(+)

diff --git a/cmdutils.c b/cmdutils.c
index b35180e..0e22e57 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -31,7 +31,9 @@
 
 #include "config.h"
 #include "compat/va_copy.h"
+#include "libavcodec/bytestream.h"
 #include "libavformat/avformat.h"
+#include "libavformat/isom.h"
 #include "libavfilter/avfilter.h"
 #include "libavdevice/avdevice.h"
 #include "libavresample/avresample.h"
@@ -2252,3 +2254,171 @@ int show_sinks(void *optctx, const char *opt, const 
char *arg)
 return ret;
 }
 #endif
+
+static int parse_elst(MOVElst **ret, const uint8_t *buf, int size)
+{
+GetByteContext gb;
+int i, edit_count, version;
+MOVElst *elst_data;
+
+bytestream2_init(&gb, buf, size);
+
+version = bytestream2_get_byte(&gb);
+bytestream2_skip(&gb, 3); /* flags */
+edit_count = bytestream2_get_be32(&gb);
+
+if (!edit_count)
+return 0;
+
+elst_data = av_malloc_array(edit_count, sizeof(*elst_data));
+if (!elst_data)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < edit_count && bytestream2_get_bytes_left(&gb) > 0; i++) {
+MOVElst *e = &elst_data[i];
+
+if (version == 1) {
+e->duration = bytestream2_get_be64(&gb);
+e->time = bytestream2_get_be64(&gb);
+} else {
+e->duration = bytestream2_get_be32(&gb);
+e->time = (int32_t)bytestream2_get_be32(&gb);
+}
+e->rate = bytestream2_get_be32(&gb) / 65536.0;
+}
+
+*ret = elst_data;
+return i;
+}
+
+static int get_elst_lavfi_graph_str(AVBPrint *bp, const AVStream *st, int64_t 
start_time)
+{
+int i, elst_count, size;
+AVBPrint select;
+AVBPrint setpts;
+MOVElst *elst;
+AVRational tb;
+
+const uint8_t *buf = av_stream_get_side_data(st, AV_PKT_DATA_MOV_TIMELINE, 
&size);
+if (!buf || size <= 4)
+return 0;
+
+tb = av_make_q(1, AV_RB32(buf));
+
+elst_count = parse_elst(&elst, buf + 4, size - 4);
+if (elst_count <= 0)
+return elst_count;
+
+av_bprint_init(bp,  0, AV_BPRINT_SIZE_UNLIMITED);
+av_bprint_init(&select, 0, AV_BPRINT_SIZE_UNLIMITED);
+av_bprint_init(&setpts, 0, AV_BPRINT_SIZE_UNLIMITED);
+
+for (i = 0; i < elst_count; i++) {
+int64_t gap;
+const MOVElst *segment = &elst[i];
+const MOVElst *next= i < elst_count - 1 ? &elst[i + 1] : NULL;
+const MOVElst *prev= i > 0  ? &elst[i - 1] : NULL;
+int64_t rescaled_start = av_rescale_q(segment->time, tb, 
st->time_base);
+int64_t end = segment->duration ? segment->time + segment->duration : 
-1;
+
+if (!segment->duration && next)
+end = next->time;
+
+if (select.str[0]) {
+av_bprintf(&select, "+");
+} if (end == -1) {
+av_bprintf(&select, "gte(pts,%"PRId64")", rescaled_start);
+} else {
+const int64_t rescaled_end = av_rescale_q(end, tb, st->time_base);
+av_bprintf(&select, "between(pts,%"PRId64",%"PRId64"-1)",
+   rescaled_start, rescaled_end);
+}
+
+if (segment->time == -1)
+/* XXX: we are supposed to insert initial silence/emptiness here */
+gap = segment->duration;
+else if (prev)
+gap = segment->time - prev->time - prev->duration;
+else
+gap = segment->time;
+gap *= segment->rate;
+
+if (gap) {
+if (!*setpts.str)
+av_bprintf(&setpts, "PTS");
+gap = av_rescale_q(gap, tb, st->time_base);
+av_bprintf(&setpts, "-if(gte(PTS,%"PRId64"),%"PRId64",0)",
+   segment->time, gap);
+}
+}
+
+av_freep(&elst);
+
+if (select.str[0] && av_bprint_is_complete(&select) && 
av_bprint_is_complete(&setpts)) {
+const char *tstr = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? "a" : 
"";
+int64_t rescaled_start_time = start_time == AV_NOPTS_VALUE ? 0 : 
av_rescale_q(start_time, AV_TIME_BASE_Q, st->time_base);
+
+av_bprintf(bp, "[tl_in] ");
+
+/* make sure the following filters will not take into account the PTS
+ * shift that can occur with ffmpeg (-ss) */
+if (rescaled_start_time)
+av_bprintf(bp, "%ssetpts=PTS+%"PRId64", ", tstr, 
rescaled_start_time);
+
+/* select the time ranges
+ * FIXME: aselect should be replaced with a sample accurate filter */
+av_bprintf(bp, "%sselect='%s'", tstr, select.str);
+
+/* insert the time adjustment filter if there are time time gaps (often
+ * the case if there is more than one entry) */
+if (setpts.str[0])
+av_bprintf(bp, ", %ssetpts='%s'", tstr, setpts.str);
+
+/* rest

[FFmpeg-devel] [PATCH 1/5] avformat/mov: export edit list as stream side data

2015-01-06 Thread Clément Bœsch
From: Clément Bœsch 

Add a AV_PKT_DATA_MOV_TIMELINE stream side data which will be used by
the MOV/MP4 demuxer when "ignore_editlist" option is set to "export"
(or -1, not the default).

Note: exporting the timeline as side data inhibits current demuxer
heuristics.

TODO: bump micro
---
 libavcodec/avcodec.h |  7 +++
 libavformat/dump.c   |  3 +++
 libavformat/mov.c| 46 --
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 99467bb..0b761b4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1094,6 +1094,13 @@ enum AVPacketSideDataType {
  * side data includes updated metadata which appeared in the stream.
  */
 AV_PKT_DATA_METADATA_UPDATE,
+
+/**
+ * MOV/MP4 elst atom, with additionnal 4 bytes at the beginning containing
+ * the presentation time scale to be used as a unit for the values in the
+ * table.
+ */
+AV_PKT_DATA_MOV_TIMELINE,
 };
 
 typedef struct AVPacketSideData {
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 56b37ff..6436521 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -328,6 +328,9 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 av_log(ctx, AV_LOG_INFO, "stereo3d: ");
 dump_stereo3d(ctx, &sd);
 break;
+case AV_PKT_DATA_MOV_TIMELINE:
+av_log(ctx, AV_LOG_INFO, "mov edit list");
+break;
 default:
 av_log(ctx, AV_LOG_WARNING,
"unknown side data type %d (%d bytes)", sd.type, sd.size);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 248faf7..27e0232 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3209,14 +3209,54 @@ free_and_return:
 #endif
 }
 
+static int export_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+int n;
+uint8_t *buf;
+AVPacketSideData *sd, *tmp;
+AVStream *st = c->fc->streams[c->fc->nb_streams-1];
+int64_t start = avio_tell(pb);
+
+buf = av_malloc(atom.size + 4);
+if (!buf)
+return AVERROR(ENOMEM);
+
+AV_WB32(buf, c->time_scale);
+
+n = avio_read(pb, buf + 4, atom.size);
+if (n != atom.size) {
+av_log(c->fc, AV_LOG_ERROR, "Unexpected read error in ELST\n");
+return AVERROR_INVALIDDATA;
+}
+
+tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
+if (!tmp) {
+av_freep(&buf);
+return AVERROR(ENOMEM);
+}
+st->side_data = tmp;
+st->nb_side_data++;
+
+sd = &st->side_data[st->nb_side_data - 1];
+sd->type = AV_PKT_DATA_MOV_TIMELINE;
+sd->data = buf;
+sd->size = atom.size + 4;
+
+return avio_seek(pb, start, SEEK_SET);
+}
+
 /* edit list atom */
 static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 MOVStreamContext *sc;
 int i, edit_count, version;
 
-if (c->fc->nb_streams < 1 || c->ignore_editlist)
+if (c->fc->nb_streams < 1 || c->ignore_editlist == 1)
 return 0;
+
+if (c->ignore_editlist == -1)
+return export_elst(c, pb, atom);
+
 sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
 
 version = avio_r8(pb); /* version */
@@ -4261,7 +4301,9 @@ static const AVOption mov_options[] = {
 OFFSET(use_absolute_path), FF_OPT_TYPE_INT, {.i64 = 0},
 0, 1, FLAGS},
 {"ignore_editlist", "", OFFSET(ignore_editlist), FF_OPT_TYPE_INT, {.i64 = 
0},
-0, 1, FLAGS},
+-1, 1, FLAGS, "editlist_mode"},
+{"export", "ignore edit list and export is as side data",
+0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, FLAGS, "editlist_mode" },
 {"use_mfra_for",
 "use mfra for fragment timestamps",
 OFFSET(use_mfra_for), FF_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO},
-- 
2.2.1

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


[FFmpeg-devel] MOV edit list support using side data and libavfilter

2015-01-06 Thread Clément Bœsch
Latest attempt, I hope people like it better.

Basic idea: export on demand the elst atom using side data and let the
application (here ffmpeg/ffplay through cmdutils) parse it and honor it
as they fit (here with libavfilter).

I'm a bit uncertain about the FATE changes, and I also don't like the idea of
the audio being inaccurate (no frame cutting, I don't see any simple way of
doing this with libavfilter). Maybe we should write a filter for that specific
purpose.

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


Re: [FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-06 Thread tim nicholson
On 06/01/15 16:31, compn wrote:
> On Tue, 6 Jan 2015 10:10:53 +
> Paul B Mahol  wrote:
> 
>> On 1/6/15, Stefano Sabatini  wrote:
>>> On date Monday 2015-01-05 16:33:44 +, Paul B Mahol encoded:
 Signed-off-by: Paul B Mahol 
  3 files changed, 147 insertions(+)
  create mode 100644 libavfilter/f_deinterleave.c
>>>
>>> select works as this, with the expression:
>>> select=n=N:e='mod(n,N)'
>>
>> I forgot that select can do it, so patch dropped.
> 
> should that select line go into the manual / examples somewhere?
> 

I think the last example is a version of that, (assuming the misssing +1
above is a typo, as if e=0 the frame is dropped)

> -compn
> [.]

-- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: support USLT tags

2015-01-06 Thread Michael Niedermayer
On Tue, Jan 06, 2015 at 07:19:28AM +0100, wm4 wrote:
> On Mon, 5 Jan 2015 21:10:31 +0100
> Michael Niedermayer  wrote:
> 
> > On Mon, Jan 05, 2015 at 06:56:20PM +0100, wm4 wrote:
> > > I think this turned out pretty terrible. There's no good way to add new
> > > custom tags that write to AVFormatContext->metadata.
> > > ---
> > >  libavformat/id3v2.c | 50 
> > > ++
> > >  1 file changed, 50 insertions(+)
> > 
> > do you have a sample mp3 with such tag ?
> > 
> > [...]
> > 
> 
> international.mp3 on incoming.

applied

thanks

[...]
-- 
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] lavfi: add deinterleave filters

2015-01-06 Thread compn
On Tue, 6 Jan 2015 10:10:53 +
Paul B Mahol  wrote:

> On 1/6/15, Stefano Sabatini  wrote:
> > On date Monday 2015-01-05 16:33:44 +, Paul B Mahol encoded:
> >> Signed-off-by: Paul B Mahol 
> >>  3 files changed, 147 insertions(+)
> >>  create mode 100644 libavfilter/f_deinterleave.c
> >
> > select works as this, with the expression:
> > select=n=N:e='mod(n,N)'
> 
> I forgot that select can do it, so patch dropped.

should that select line go into the manual / examples somewhere?

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


Re: [FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

2015-01-06 Thread Vanista Herion
Good explanation, I neglected telecine; wasn't aware of how it worked.
Agreed, yadif should handle that, the decoder cannot reverse-telecine by
itself without some kind of hinting of the original frames correspondence.
Thanks a lot.

2015-01-05 18:35 GMT-05:00 Michael Niedermayer :

> On Mon, Jan 05, 2015 at 03:17:32PM -0500, Vanista Herion wrote:
> > Some MPEG 2 video will give bad interlacing information in AVFrame. If
> the
> > parameters are used by a deinterlace filter such as yadif, frames will be
> > processed needlessly and impair the quality.
> >
> > By reviewing the code in mpegvideo.c which sets the interlaced_frame
> > and top_field_first, I noticed that picture_structure is not considered
> > whereas it probably supersedes everything else. The H.262 specification
> is
> > not very clear on that but in the case of this sample, the stream is
> > definitely progressive, picture_structure is equal to 3 (Frame picture)
> and
> > top_field_first alternates true and false.
> >
> > The result is that frames come out reported as tff, bff and progressive,
> > cycling at every frame.
> > I propose a simple patch to set interlaced_frame to false when
> > picture_structure is equal to PICT_FRAME.
>
> fixed differently, that is by detecting telecined content in yadif
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> When the tyrant has disposed of foreign enemies by conquest or treaty, and
> there is nothing more to fear from them, then he is always stirring up
> some war or other, in order that the people may require a leader. -- Plato
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/aiffdec: only read codec tag when there is space in header

2015-01-06 Thread Reimar Döffinger
On 04.01.2015, at 22:44, Peter Ross  wrote:
> Signed-off-by: Peter Ross 
> ---
> Revised patch. Now passes FATE.
> 
> libavformat/aiffdec.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
> index 91ef2a4..8dbed32 100644
> --- a/libavformat/aiffdec.c
> +++ b/libavformat/aiffdec.c
> @@ -116,10 +116,12 @@ static unsigned int get_aiff_header(AVFormatContext *s, 
> int size,
> size -= 18;
> 
> /* get codec id for AIFF-C */
> -if (version == AIFF_C_VERSION1) {
> +if (version == AIFF_C_VERSION1 && size >= 4) {
> codec->codec_tag = avio_rl32(pb);
> codec->codec_id  = ff_codec_get_id(ff_codec_aiff_tags, 
> codec->codec_tag);
> size -= 4;
> +} else {
> +version = AIFF;

If we were to add a 3rd version, like this it would always the overridden to 
AIFF here, which seems not very good to me.
Also nit: wouldn't this in be more readable the other way round anyway while 
solving that concern? At least I think having one-liners in the if instead of 
the else part is better, though some people say you should put the less common 
path in the else (though strictly speaking the else isn't even necessary with 
flipped order).
if (size < 4) {
version = AIFF;
} else if () {
}
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-06 Thread Paul B Mahol
On 1/6/15, Stefano Sabatini  wrote:
> On date Monday 2015-01-05 16:33:44 +, Paul B Mahol encoded:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/Makefile |   2 +
>>  libavfilter/allfilters.c |   2 +
>>  libavfilter/f_deinterleave.c | 143
>> +++
>>  3 files changed, 147 insertions(+)
>>  create mode 100644 libavfilter/f_deinterleave.c
>
> select works as this, with the expression:
> select=n=N:e='mod(n,N)'

I forgot that select can do it, so patch dropped.
>
> [...]
> --
> FFmpeg = Foolish and Fabulous Mastodontic Philosophical Evil Gospel
> ___
> 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] lavfi: add deinterleave filters

2015-01-06 Thread Stefano Sabatini
On date Monday 2015-01-05 16:33:44 +, Paul B Mahol encoded:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   2 +
>  libavfilter/f_deinterleave.c | 143 
> +++
>  3 files changed, 147 insertions(+)
>  create mode 100644 libavfilter/f_deinterleave.c

select works as this, with the expression:
select=n=N:e='mod(n,N)'

[...]
-- 
FFmpeg = Foolish and Fabulous Mastodontic Philosophical Evil Gospel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-06 Thread Paul B Mahol
On 1/5/15, Michael Niedermayer  wrote:
> On Mon, Jan 05, 2015 at 04:33:44PM +, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/Makefile |   2 +
>>  libavfilter/allfilters.c |   2 +
>>  libavfilter/f_deinterleave.c | 143
>> +++
>>  3 files changed, 147 insertions(+)
>>  create mode 100644 libavfilter/f_deinterleave.c
>>
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index 0ead6c5..17e49ee 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -29,6 +29,7 @@ OBJS = allfilters.o
>>\
>>
>>  OBJS-$(CONFIG_AVCODEC)   += avcodec.o
>>
>> +OBJS-$(CONFIG_ADEINTERLEAVE_FILTER)  += f_deinterleave.o
>>  OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
>>  OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
>>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
>> @@ -108,6 +109,7 @@ OBJS-$(CONFIG_CROPDETECT_FILTER) +=
>> vf_cropdetect.o
>>  OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
>>  OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += vf_dctdnoiz.o
>>  OBJS-$(CONFIG_DECIMATE_FILTER)   += vf_decimate.o
>> +OBJS-$(CONFIG_DEINTERLEAVE_FILTER)   += f_deinterleave.o
>>  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
>>  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
>>  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> index 6543629..66982f5 100644
>> --- a/libavfilter/allfilters.c
>> +++ b/libavfilter/allfilters.c
>> @@ -50,6 +50,7 @@ void avfilter_register_all(void)
>>  REGISTER_FILTER(AEVAL,  aeval,  af);
>>  REGISTER_FILTER(AFADE,  afade,  af);
>>  REGISTER_FILTER(AFORMAT,aformat,af);
>> +REGISTER_FILTER(ADEINTERLEAVE,  adeinterleave,  af);
>>  REGISTER_FILTER(AINTERLEAVE,ainterleave,af);
>>  REGISTER_FILTER(ALLPASS,allpass,af);
>>  REGISTER_FILTER(AMERGE, amerge, af);
>> @@ -124,6 +125,7 @@ void avfilter_register_all(void)
>>  REGISTER_FILTER(CURVES, curves, vf);
>>  REGISTER_FILTER(DCTDNOIZ,   dctdnoiz,   vf);
>>  REGISTER_FILTER(DECIMATE,   decimate,   vf);
>> +REGISTER_FILTER(DEINTERLEAVE,   deinterleave,   vf);
>>  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
>>  REGISTER_FILTER(DELOGO, delogo, vf);
>>  REGISTER_FILTER(DESHAKE,deshake,vf);
>> diff --git a/libavfilter/f_deinterleave.c b/libavfilter/f_deinterleave.c
>> new file mode 100644
>> index 000..2209390
>> --- /dev/null
>> +++ b/libavfilter/f_deinterleave.c
>> @@ -0,0 +1,143 @@
>> +/*
>> + * Copyright (c) 2015 Paul B Mahol
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> 02110-1301 USA
>> + */
>> +
>> +/**
>> + * @file
>> + * audio and video de-interleaver
>> + */
>> +
>> +#include "libavutil/opt.h"
>> +#include "avfilter.h"
>> +#include "formats.h"
>> +#include "internal.h"
>> +#include "audio.h"
>> +#include "video.h"
>> +
>> +typedef struct {
>> +const AVClass *class;
>> +int nb_outputs;
>> +int index;
>> +} DeinterleaveContext;
>> +
>> +#define OFFSET(x) offsetof(DeinterleaveContext, x)
>> +
>> +#define DEFINE_OPTIONS(filt_name, flags_)   \
>> +static const AVOption filt_name##_options[] = { \
>> +   { "nb_outputs", "set number of outputs", OFFSET(nb_outputs),
>> AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
>> +   { NULL } \
>> +}
>> +
>> +static av_cold int deinterleave_init(AVFilterContext *ctx)
>> +{
>> +DeinterleaveContext *s = ctx->priv;
>> +int i;
>> +
>> +for (i = 0; i < s->nb_outputs; i++) {
>> +char name[32];
>> +AVFilterPad pad = { 0 };
>> +
>> +snprintf(name, sizeof(name), "output%d", i);
>> +pad.type = ctx->filter->inputs[0].type;
>> +pad.name = av_strdup(name);
>> +
>> +ff_insert_outpad(ctx, i, &pad);
>> +}
>> +
>> +return 0;
>> +}
>> +
>> +static int

Re: [FFmpeg-devel] [PATCH] lavfi: check av_strdup() return value

2015-01-06 Thread Clément Bœsch
On Tue, Jan 06, 2015 at 09:43:52AM +, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/af_amix.c | 2 ++
>  libavfilter/af_join.c | 2 ++
>  libavfilter/split.c   | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
> index e40969f..fd9d135 100644
> --- a/libavfilter/af_amix.c
> +++ b/libavfilter/af_amix.c
> @@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
>  snprintf(name, sizeof(name), "input%d", i);
>  pad.type   = AVMEDIA_TYPE_AUDIO;
>  pad.name   = av_strdup(name);
> +if (!pad.name)
> +return AVERROR(ENOMEM);
>  pad.filter_frame   = filter_frame;
>  
>  ff_insert_inpad(ctx, i, &pad);
> diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
> index a1717c6..71a454b 100644
> --- a/libavfilter/af_join.c
> +++ b/libavfilter/af_join.c
> @@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
>  snprintf(name, sizeof(name), "input%d", i);
>  pad.type   = AVMEDIA_TYPE_AUDIO;
>  pad.name   = av_strdup(name);
> +if (!pad.name)
> +return AVERROR(ENOMEM);
>  pad.filter_frame   = filter_frame;
>  
>  pad.needs_fifo = 1;
> diff --git a/libavfilter/split.c b/libavfilter/split.c
> index 6abd5ee..7353810 100644
> --- a/libavfilter/split.c
> +++ b/libavfilter/split.c
> @@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
>  snprintf(name, sizeof(name), "output%d", i);
>  pad.type = ctx->filter->inputs[0].type;
>  pad.name = av_strdup(name);
> +if (!pad.name)
> +return AVERROR(ENOMEM);
>  
>  ff_insert_outpad(ctx, i, &pad);
>  }

Sure OK

-- 
Clément B.


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


[FFmpeg-devel] [PATCH] lavfi: check av_strdup() return value

2015-01-06 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/af_amix.c | 2 ++
 libavfilter/af_join.c | 2 ++
 libavfilter/split.c   | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index e40969f..fd9d135 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
 snprintf(name, sizeof(name), "input%d", i);
 pad.type   = AVMEDIA_TYPE_AUDIO;
 pad.name   = av_strdup(name);
+if (!pad.name)
+return AVERROR(ENOMEM);
 pad.filter_frame   = filter_frame;
 
 ff_insert_inpad(ctx, i, &pad);
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index a1717c6..71a454b 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
 snprintf(name, sizeof(name), "input%d", i);
 pad.type   = AVMEDIA_TYPE_AUDIO;
 pad.name   = av_strdup(name);
+if (!pad.name)
+return AVERROR(ENOMEM);
 pad.filter_frame   = filter_frame;
 
 pad.needs_fifo = 1;
diff --git a/libavfilter/split.c b/libavfilter/split.c
index 6abd5ee..7353810 100644
--- a/libavfilter/split.c
+++ b/libavfilter/split.c
@@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
 snprintf(name, sizeof(name), "output%d", i);
 pad.type = ctx->filter->inputs[0].type;
 pad.name = av_strdup(name);
+if (!pad.name)
+return AVERROR(ENOMEM);
 
 ff_insert_outpad(ctx, i, &pad);
 }
-- 
1.7.11.2

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


Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: export the full UMID as metadata

2015-01-06 Thread tim nicholson
On 05/01/15 20:41, Mark Reid wrote:
> Hi,
> This patch exports the full umid of packages as metadata. ffmpeg currently
> only exports the material number portion of the umid.
> 
> The new format is
>---
> example:
>060a2b340101010101010f00-13-00-53dc416b9a770251060e2b347f7f2a80
> 

I think this is a good idea, but if we are going to make the change can
we make the exported format be SMPTE330 compliant? Annex C (normative)
states:-

"By default, the hexadecimal representation should be preceded by the
identifier ‘0x’. This default method of identification will result in 66
hexadecimal characters to represent a basic UMID as follows:
0x060A2B340101010501010D13 ... etc.
The hexadecimal letters should be encoded as upper case (A...F)."


> Some applications use the umids to link to mxf media instead using file paths.
> I've been using ffmpeg for some AAF work and have encountered
> MXF files with different ISO labels and having just the material number alone 
> is not
> enough to link to media for Media Composer.
> 
> For more on umids, this paper explains them pretty well
> http://www.digitalpreservationeurope.eu/publications/briefs/UMID_Unique%20Material%20Identifier.pdf
> 
> umids also have a optional extened 32 bytes, but I've yet to see a file that
> has them.
> 
> Mark Reid (1):
>   libavformat/mxfdec.c: export the full UMID as metadata
> 
>  libavformat/mxfdec.c | 39 ---
>  1 file changed, 32 insertions(+), 7 deletions(-)
> 


-- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel