Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: add alias expr_int_format to expansion function eif

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 12:05:42AM +0200, Nicolas George wrote:
 Le decadi 30 messidor, an CCXXII, Andrey Utkin a écrit :
  ---
   doc/filters.texi  | 2 +-
   libavfilter/vf_drawtext.c | 3 ++-
   2 files changed, 3 insertions(+), 2 deletions(-)
 
 IMHO, since the function was added extremely recently, it is ok to just
 change the name.
 

It's not present in 2.3 release?

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: add alias expr_int_format to expansion function eif

2014-07-18 Thread Nicolas George
Le decadi 30 messidor, an CCXXII, Clément Bœsch a écrit :
 It's not present in 2.3 release?

No, it was applied a little bit later.

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 3/4] smacker: remove dead code

2014-07-18 Thread Paul B Mahol
On Fri, Jul 18, 2014 at 4:25 AM, Timothy Gu timothyg...@gmail.com wrote:

 Signed-off-by: Timothy Gu timothyg...@gmail.com
 ---
  libavcodec/smacker.c | 2 --
  1 file changed, 2 deletions(-)

 diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
 index 644beb3..518bdad 100644
 --- a/libavcodec/smacker.c
 +++ b/libavcodec/smacker.c
 @@ -438,7 +438,6 @@ static int decode_frame(AVCodecContext *avctx, void
 *data, int *got_frame,
  bw = avctx-width  2;
  bh = avctx-height  2;
  blocks = bw * bh;
 -out = smk-pic-data[0];
  stride = smk-pic-linesize[0];
  while(blk  blocks) {
  int type, run, mode;
 @@ -499,7 +498,6 @@ static int decode_frame(AVCodecContext *avctx, void
 *data, int *got_frame,
  out += stride;
  out[0] = out[1] = pix  0xFF;
  out[2] = out[3] = pix  8;
 -out += stride;



 break;
  case 2:
  for(i = 0; i  2; i++) {
 --
 1.9.1

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


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


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Nicolas Martyanoff
Hi,

Any chance someone could take a look to these patches ?

-- 
Nicolas Martyanoff
http://wandrian.net
khae...@gmail.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Stefano Sabatini
On date Friday 2014-07-18 10:07:21 +0200, Nicolas Martyanoff encoded:
 Hi,
 
 Any chance someone could take a look to these patches ?

Could you send them to this mailing-list?

This way we will be able to make a proper inline review, thanks.
-- 
FFmpeg = Fundamentalist  Freak Mysterious Power Ecstatic Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Nicolas Martyanoff
The FFmpeg developer info page said it was fine to use github instead of
mailing patches, but if you prefer, I can mail them.

-- 
Nicolas Martyanoff
http://wandrian.net
khae...@gmail.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffmpeg_filter: refuse to configure input without a decoder.

2014-07-18 Thread Nicolas George
The decoder is necessary in order to filter frames.
This makes the error message clearer in this case:
currently, it will usually fail because the pixel or sample
format is not defined and is converted into (null)
(non-portable).

Signed-off-by: Nicolas George geo...@nsup.org
---
 ffmpeg_filter.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 50ee422..b6dc42f 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -830,6 +830,12 @@ static int configure_input_filter(FilterGraph *fg, 
InputFilter *ifilter,
 av_freep(ifilter-name);
 DESCRIBE_FILTER_LINK(ifilter, in, 1);
 
+if (!ifilter-ist-dec) {
+av_log(NULL, AV_LOG_ERROR,
+   No decoder for stream #%d:%d, filtering impossible\n,
+   ifilter-ist-file_index, ifilter-ist-st-index);
+return AVERROR_DECODER_NOT_FOUND;
+}
 switch (avfilter_pad_get_type(in-filter_ctx-input_pads, in-pad_idx)) {
 case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, 
in);
 case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, 
in);
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: correctly compute target duration

2014-07-18 Thread Nicolas Martyanoff
With HLS, the duration of all segments must be lower or equal to the target
duration. Therefore floor(duration + 0.5) yields incorrect results.

For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
correct result is 2.0.
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 86447d8..388a23a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -141,7 +141,7 @@ static int hls_window(AVFormatContext *s, int last)
 
 for (en = hls-list; en; en = en-next) {
 if (target_duration  en-duration)
-target_duration = (int) floor(en-duration + 0.5);
+target_duration = ceil(en-duration);
 }
 
 avio_printf(hls-pb, #EXTM3U\n);
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 3/7] avformat/hlsenc: fix segmentation issues

2014-07-18 Thread Nicolas Martyanoff
- Select a reference stream (the first video stream, or the first audio
  stream if there is no video stream) instead of using the PTS of any video
  stream.

- Control the segment length using the time since the last segment.
---
 libavformat/hlsenc.c | 165 +++
 1 file changed, 101 insertions(+), 64 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 30b320f..76cbd0e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -41,23 +41,25 @@ typedef struct HLSSegment {
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
 
-unsigned number;
 int64_t sequence;
 int64_t start_sequence;
+int nb_entries;
+int max_nb_segments;
 
 AVOutputFormat *oformat;
 AVFormatContext *ctx;
 
 float target_duration;
-int max_nb_segments;
 int wrap;
 
 int64_t recording_time;
 int has_video;
-int64_t start_pts;
-int64_t end_pts;
-double duration;  // last segment duration computed so far, in seconds
-int nb_entries;
+int64_t first_pts; /// first PTS found in the input file
+int64_t last_pts;  /// PTS of the last packet we splitted at
+
+int ref_stream; /// the index of the stream used as time reference
+
+double segment_duration; // last segment duration computed so far, in 
seconds
 
 HLSSegment *segments;
 HLSSegment *last_segment;
@@ -71,10 +73,15 @@ typedef struct HLSContext {
 static int hls_mux_init(AVFormatContext *ctx)
 {
 HLSContext *hls;
-int i;
+int i, video_ref, audio_ref;
 
 hls = ctx-priv_data;
 
+hls-segment_duration = 0.0;
+
+hls-first_pts = AV_NOPTS_VALUE;
+hls-last_pts = AV_NOPTS_VALUE;
+
 hls-ctx = avformat_alloc_context();
 if (!hls-ctx)
 return AVERROR(ENOMEM);
@@ -83,21 +90,61 @@ static int hls_mux_init(AVFormatContext *ctx)
 hls-ctx-interrupt_callback = ctx-interrupt_callback;
 av_dict_copy(hls-ctx-metadata, ctx-metadata, 0);
 
+hls-ref_stream = -1;
+video_ref = -1;
+audio_ref = -1;
+
 for (i = 0; i  ctx-nb_streams; i++) {
-AVStream *stream;
+AVStream *stream, *input_stream;
 
+input_stream = ctx-streams[i];
+
+/* Create output stream */
 stream = avformat_new_stream(hls-ctx, NULL);
 if (!stream)
 return AVERROR(ENOMEM);
 
-avcodec_copy_context(stream-codec, ctx-streams[i]-codec);
-stream-sample_aspect_ratio = ctx-streams[i]-sample_aspect_ratio;
+avcodec_copy_context(stream-codec, input_stream-codec);
+stream-sample_aspect_ratio = input_stream-sample_aspect_ratio;
+
+/* See if we can use this stream as a time reference. We use the first
+ * video stream found, or the first audio stream if there is no video
+ * stream. */
+switch (input_stream-codec-codec_type) {
+case AVMEDIA_TYPE_VIDEO:
+hls-has_video++;
+if (video_ref == -1)
+video_ref = i;
+break;
+
+case AVMEDIA_TYPE_AUDIO:
+if (audio_ref == -1)
+audio_ref = i;
+break;
+
+default:
+break;
+}
+}
+
+if (hls-has_video  1) {
+av_log(ctx, AV_LOG_WARNING,
+   More than a single video stream present, 
+   expect issues decoding it.\n);
+}
+
+if (video_ref = 0) {
+hls-ref_stream = video_ref;
+} else if (audio_ref = 0) {
+hls-ref_stream = audio_ref;
+} else {
+return AVERROR_STREAM_NOT_FOUND;
 }
 
 return 0;
 }
 
-static int hls_append_segment(HLSContext *hls, double duration)
+static int hls_append_segment(HLSContext *hls)
 {
 const char *basename;
 HLSSegment *segment;
@@ -111,7 +158,8 @@ static int hls_append_segment(HLSContext *hls, double 
duration)
 basename = av_basename(hls-ctx-filename);
 av_strlcpy(segment-filename, basename, sizeof(segment-filename));
 
-segment-duration = duration;
+segment-duration = hls-segment_duration;
+
 segment-next = NULL;
 
 if (!hls-segments) {
@@ -214,7 +262,6 @@ static int hls_create_file(AVFormatContext *ctx)
Invalid segment filename template '%s'\n, 
hls-media_filename);
 return AVERROR(EINVAL);
 }
-hls-number++;
 
 ret = avio_open2(hls-ctx-pb, hls-ctx-filename, AVIO_FLAG_WRITE,
  ctx-interrupt_callback, NULL);
@@ -230,30 +277,15 @@ static int hls_create_file(AVFormatContext *ctx)
 static int hls_write_header(AVFormatContext *ctx)
 {
 HLSContext *hls;
-int ret, i;
+int ret;
 char *dot;
 size_t basename_size;
 char filename[1024];
 
 hls = ctx-priv_data;
 
-hls-sequence   = hls-start_sequence;
+hls-sequence  = hls-start_sequence;
 hls-recording_time = hls-target_duration * AV_TIME_BASE;
-hls-start_pts  = AV_NOPTS_VALUE;
-
-/* Findout if the input file contains a 

[FFmpeg-devel] [PATCH 2/7] avformat/hlsenc: make the code easier to read

2014-07-18 Thread Nicolas Martyanoff
Before adding new features, I read the code and cleaned it. The main issue was
abstruse identifier names.

The behaviour of the muxer is *not* modified, by this patch, this is only
cosmetic. If this is not the case, it is a mistake.
---
 libavformat/hlsenc.c | 360 ++-
 1 file changed, 213 insertions(+), 147 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 388a23a..30b320f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -31,236 +31,294 @@
 #include avformat.h
 #include internal.h
 
-typedef struct ListEntry {
-char  name[1024];
-double   duration;
-struct ListEntry *next;
-} ListEntry;
+typedef struct HLSSegment {
+char filename[1024];
+double duration; /* in seconds */
+
+struct HLSSegment *next;
+} HLSSegment;
 
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
+
 unsigned number;
 int64_t sequence;
 int64_t start_sequence;
+
 AVOutputFormat *oformat;
-AVFormatContext *avf;
-float time;// Set by a private option.
-int  size; // Set by a private option.
-int  wrap; // Set by a private option.
+AVFormatContext *ctx;
+
+float target_duration;
+int max_nb_segments;
+int wrap;
+
 int64_t recording_time;
 int has_video;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
 int nb_entries;
-ListEntry *list;
-ListEntry *end_list;
-char *basename;
+
+HLSSegment *segments;
+HLSSegment *last_segment;
+
+char *media_filename;
 char *baseurl;
+
 AVIOContext *pb;
 } HLSContext;
 
-static int hls_mux_init(AVFormatContext *s)
+static int hls_mux_init(AVFormatContext *ctx)
 {
-HLSContext *hls = s-priv_data;
-AVFormatContext *oc;
+HLSContext *hls;
 int i;
 
-hls-avf = oc = avformat_alloc_context();
-if (!oc)
+hls = ctx-priv_data;
+
+hls-ctx = avformat_alloc_context();
+if (!hls-ctx)
 return AVERROR(ENOMEM);
 
-oc-oformat= hls-oformat;
-oc-interrupt_callback = s-interrupt_callback;
-av_dict_copy(oc-metadata, s-metadata, 0);
+hls-ctx-oformat = hls-oformat;
+hls-ctx-interrupt_callback = ctx-interrupt_callback;
+av_dict_copy(hls-ctx-metadata, ctx-metadata, 0);
 
-for (i = 0; i  s-nb_streams; i++) {
-AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
+for (i = 0; i  ctx-nb_streams; i++) {
+AVStream *stream;
+
+stream = avformat_new_stream(hls-ctx, NULL);
+if (!stream)
 return AVERROR(ENOMEM);
-avcodec_copy_context(st-codec, s-streams[i]-codec);
-st-sample_aspect_ratio = s-streams[i]-sample_aspect_ratio;
+
+avcodec_copy_context(stream-codec, ctx-streams[i]-codec);
+stream-sample_aspect_ratio = ctx-streams[i]-sample_aspect_ratio;
 }
 
 return 0;
 }
 
-static int append_entry(HLSContext *hls, double duration)
+static int hls_append_segment(HLSContext *hls, double duration)
 {
-ListEntry *en = av_malloc(sizeof(*en));
+const char *basename;
+HLSSegment *segment;
 
-if (!en)
+/* Create a new segment and append it to the segment list */
+
+segment = av_malloc(sizeof(*segment));
+if (!segment)
 return AVERROR(ENOMEM);
 
-av_strlcpy(en-name, av_basename(hls-avf-filename), sizeof(en-name));
+basename = av_basename(hls-ctx-filename);
+av_strlcpy(segment-filename, basename, sizeof(segment-filename));
 
-en-duration = duration;
-en-next = NULL;
+segment-duration = duration;
+segment-next = NULL;
 
-if (!hls-list)
-hls-list = en;
-else
-hls-end_list-next = en;
+if (!hls-segments) {
+hls-segments = segment;
+} else {
+hls-last_segment-next = segment;
+}
 
-hls-end_list = en;
+hls-last_segment = segment;
 
-if (hls-size  hls-nb_entries = hls-size) {
-en = hls-list;
-hls-list = en-next;
-av_free(en);
-} else
+if (hls-max_nb_segments  0  hls-nb_entries = hls-max_nb_segments) {
+segment = hls-segments;
+hls-segments = segment-next;
+av_free(segment);
+} else {
 hls-nb_entries++;
+}
 
 hls-sequence++;
 
 return 0;
 }
 
-static void free_entries(HLSContext *hls)
+static void hls_free_segments(HLSContext *hls)
 {
-ListEntry *p = hls-list, *en;
+HLSSegment *segment;
 
-while(p) {
-en = p;
-p = p-next;
-av_free(en);
+segment = hls-segments;
+
+while (segment) {
+HLSSegment *next;
+
+next = segment-next;
+av_free(segment);
+segment = next;
 }
 }
 
-static int hls_window(AVFormatContext *s, int last)
+static int hls_generate_playlist(AVFormatContext *ctx, int last)
 {
-HLSContext *hls = s-priv_data;
-ListEntry *en;
-int 

[FFmpeg-devel] [PATCH 4/7] avformat/hlsenc: do not regenerate the playlist for each segment

2014-07-18 Thread Nicolas Martyanoff
Since we need all segments to find out the target duration, we can only
generate the playlist after writing all segments.

There is no need to rewrite the segment list every time we create a new
segment file.
---
 libavformat/hlsenc.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 76cbd0e..5dde17a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -198,7 +198,7 @@ static void hls_free_segments(HLSContext *hls)
 }
 }
 
-static int hls_generate_playlist(AVFormatContext *ctx, int last)
+static int hls_generate_playlist(AVFormatContext *ctx)
 {
 HLSContext *hls;
 HLSSegment *segment;
@@ -233,8 +233,7 @@ static int hls_generate_playlist(AVFormatContext *ctx, int 
last)
 (hls-baseurl ? hls-baseurl : ), segment-filename);
 }
 
-if (last)
-avio_printf(hls-pb, #EXT-X-ENDLIST\n);
+avio_printf(hls-pb, #EXT-X-ENDLIST\n);
 
 avio_closep(hls-pb);
 return 0;
@@ -395,10 +394,6 @@ static int hls_write_packet(AVFormatContext *ctx, AVPacket 
*pkt)
 ret = hls_create_file(ctx);
 if (ret)
 return ret;
-
-ret = hls_generate_playlist(ctx, 0);
-if (ret  0)
-return ret;
 }
 
 ret = ff_write_chained(hls-ctx, pkt-stream_index, pkt, ctx);
@@ -420,7 +415,7 @@ static int hls_write_trailer(struct AVFormatContext *ctx)
 av_free(hls-media_filename);
 hls_append_segment(hls);
 
-hls_generate_playlist(ctx, 1);
+hls_generate_playlist(ctx);
 
 hls_free_segments(hls);
 avio_close(hls-pb);
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 5/7] avformat/hlsenc: add single file mode

2014-07-18 Thread Nicolas Martyanoff
HLS version 4 offers the possibility to keep the media file whole instead of
splitting it. In that case, segments are specified with byte ranges.

We introduce a new '-hls_flags' option for the hlsenc muxer, with a single
flag for the time being, 'single_file'.
---
 doc/muxers.texi  | 23 ++---
 libavformat/hlsenc.c | 91 ++--
 2 files changed, 93 insertions(+), 21 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index dc2a08b..186619e 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -194,15 +194,19 @@ can not be smaller than one centi second.
 Apple HTTP Live Streaming muxer that segments MPEG-TS according to
 the HTTP Live Streaming (HLS) specification.
 
-It creates a playlist file and numbered segment files. The output
-filename specifies the playlist filename; the segment filenames
-receive the same basename as the playlist, a sequential number and
-a .ts extension.
+It creates a playlist file, and one or more segment files. The output filename
+specifies the playlist filename.
+
+By default, the muxer creates a file for each segment produced. These files
+have the same name as the playlist, followed by a sequential number and a
+.ts extension.
 
 For example, to convert an input file with @command{ffmpeg}:
 @example
 ffmpeg -i in.nut out.m3u8
 @end example
+This example will produce the playlist, @file{out.m3u8}, and segment files:
+@file{out0.ts}, @file{out1.ts}, @file{out2.ts}, etc.
 
 See also the @ref{segment} muxer, which provides a more generic and
 flexible implementation of a segmenter, and can be used to perform HLS
@@ -241,6 +245,17 @@ Note that the playlist sequence number must be unique for 
each segment
 and it is not to be confused with the segment filename sequence number
 which can be cyclic, for example if the @option{wrap} option is
 specified.
+
+@item hls_flags single_file
+If this flag is set, the muxer will store all segments in a single MPEG-TS
+file, and will use byte ranges in the playlist. HLS playlists generated with
+this way will have the version number 4.
+For example:
+@example
+ffmpeg -i in.nut -hls_flags single_file out.m3u8
+@end example
+Will produce the playlist, @file{out.m3u8}, and a single segment file,
+@file{out.ts}.
 @end table
 
 @anchor{ico}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 5dde17a..8b644a2 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -34,10 +34,17 @@
 typedef struct HLSSegment {
 char filename[1024];
 double duration; /* in seconds */
+size_t size; /* in bytes */
+int64_t pos; /* in bytes */
 
 struct HLSSegment *next;
 } HLSSegment;
 
+typedef enum HLSFlags {
+// Generate a single media file and use byte ranges in the playlist.
+HLS_SINGLE_FILE = (1  0),
+} HLSFlags;
+
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
 
@@ -51,6 +58,7 @@ typedef struct HLSContext {
 
 float target_duration;
 int wrap;
+uint32_t flags; // enum HLSFlags
 
 int64_t recording_time;
 int has_video;
@@ -60,6 +68,8 @@ typedef struct HLSContext {
 int ref_stream; /// the index of the stream used as time reference
 
 double segment_duration; // last segment duration computed so far, in 
seconds
+size_t segment_size; // in bytes
+int64_t segment_pos; // offset in bytes
 
 HLSSegment *segments;
 HLSSegment *last_segment;
@@ -78,6 +88,8 @@ static int hls_mux_init(AVFormatContext *ctx)
 hls = ctx-priv_data;
 
 hls-segment_duration = 0.0;
+hls-segment_size = 0;
+hls-segment_pos = 0;
 
 hls-first_pts = AV_NOPTS_VALUE;
 hls-last_pts = AV_NOPTS_VALUE;
@@ -159,6 +171,8 @@ static int hls_append_segment(HLSContext *hls)
 av_strlcpy(segment-filename, basename, sizeof(segment-filename));
 
 segment-duration = hls-segment_duration;
+segment-size = hls-segment_size;
+segment-pos = hls-segment_pos;
 
 segment-next = NULL;
 
@@ -204,12 +218,22 @@ static int hls_generate_playlist(AVFormatContext *ctx)
 HLSSegment *segment;
 int target_duration;
 int64_t sequence;
+unsigned int version;
 int ret;
 
 hls = ctx-priv_data;
 target_duration = 0;
 ret = 0;
 
+if (hls-flags  HLS_SINGLE_FILE) {
+/* Byte ranges are part of HLS version 4. */
+version = 4;
+} else {
+/* We use floating point values for segment durations, which are part
+ * of HLS version 3. */
+version = 3;
+}
+
 ret = avio_open2(hls-pb, ctx-filename, AVIO_FLAG_WRITE,
  ctx-interrupt_callback, NULL);
 if (ret  0)
@@ -221,7 +245,7 @@ static int hls_generate_playlist(AVFormatContext *ctx)
 }
 
 avio_printf(hls-pb, #EXTM3U\n);
-avio_printf(hls-pb, #EXT-X-VERSION:3\n);
+avio_printf(hls-pb, #EXT-X-VERSION:%u\n, version);
 avio_printf(hls-pb, #EXT-X-TARGETDURATION:%d\n, target_duration);
 
 sequence = FFMAX(hls-start_sequence, hls-sequence - 

Re: [FFmpeg-devel] A few filter questions

2014-07-18 Thread Gerion Entrup
Am Donnerstag 17 Juli 2014, 17:24:35 schrieb Clément Bœsch:
 On Thu, Jul 17, 2014 at 04:56:08PM +0200, Gerion Entrup wrote:
 [...]
 
   Also, you still have the string metadata possibility (git grep SET_META
   libavfilter).
  
  Hmm, thank you, I will take a look at it. If I see it right, it is used to
  fill a dictionary per frame with some kind of data?
 
 Strings only, so you'll have to find a serialization somehow. Maybe simply
 an ascii hex string or something. But yeah, it just allows you to map some
 key → value string couples to the frames passing by in the filter.
 
 How huge is the information to store per frame?
82 byte per frame for the finesignature
(Could be split again in three parts: An one byte confidence, a 5 byte words 
vector, and a 76 byte framesignature, something like:
struct finesignature{
uint8_t confidence;
uint8_t words[5];
uint8_t framesignature[76]
})
152 byte per 90 frames for the coursesignature
(Note, that there are 2 coursesignatures with an offset of 45 frames:
0-89
45-134
90-179
...)

If I see it right, there are two possibilies:
Write as chars in the output (looks crappy, but needs the same amount of 
memory).
Write as ascii hex in the output (looks nice, but needs twice as much memory).

 
 [...]
 
   stdout/stderr really isn't a good thing. Using metadata is way better
   because you can output them from ffprobe, and parse them according to
   various outputs (XML, CSV, JSON, ...).
  
  Sounds good…
 
 tools/normalize.py make use of such feature if you want examples (that's
 the -of option of ffprobe)
Ok.
 
 [...]
 
   Am I understanding right your wondering?
  
  No ;), but anyway thanks for your answer. In your 2nd method your filter
  is a VV-V filter? Am I right, that this filter then also can take only
  one stream? Said in another way: Can a VV-V filter also behave as a V-V
  filter?
 Yes, fieldmatch is a (complex) example of this. But typically it's simply
 a filter with dynamic inputs, based on the user input. The simplest
 example would be the split filter. Look at it for an example of dynamic
 allocation of the number of inputs based on the user input (-vf split=4 is
 a V- filter)
Hmm, interesting code, thank you.
 
 [...]
 
   Check tools/normalize.py, it's using ebur128 and the metadata system.
  
  Thats what I mean. Someone has to write an external script, which calls
  ffmpeg/ffprobe two times, parse stdout of the first call and pass it to
  the
  filteroptions of the second call. As I see, there is no direct way.
  Something like:
  ffmpeg -i foo -f:a volume=mode=autodetect normalized.opus
 
 We add a discussion several time for real time with that filter. If we do
 a 2-pass, that's simply because it's more efficient. Typically, doing
 some live normalization can be done easily (we had patches for this):
 ebur128 already attaches some metadata to frames, so a following filter
 such as volume could reuse them, something like -filter_complex
 ebur128=metadata=1,volume=metadata.
 
 [...]

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


Re: [FFmpeg-devel] [PATCH] libavu: add pkt_timebase to AVFrame.

2014-07-18 Thread Hendrik Leppkes
Am 18.07.2014 12:04 schrieb Benoit Fouet benoit.fo...@free.fr:

 In order to easily correlate pkt_duration to its real duration, add the
 packet time base information to the frame structure.

 Fixes issue #3052

The code in avcodec doesn't know the timebase, unless the user tells it.

And if the user wants to tell it, there already is an avctx field for it
(pkt_timebase), no need to store it in the frame since its not going to
change in every frame.

As such, I'm not sure what this new field would solve.

 ---
  libavcodec/utils.c |  6 ++
  libavutil/frame.c  |  3 +++
  libavutil/frame.h  | 11 +++
  3 files changed, 20 insertions(+)

 diff --git a/libavcodec/utils.c b/libavcodec/utils.c
 index 9fa8e16..2fe4aba 100644
 --- a/libavcodec/utils.c
 +++ b/libavcodec/utils.c
 @@ -751,6 +751,7 @@ int ff_init_buffer_info(AVCodecContext *avctx,
AVFrame *frame)
  frame-pkt_pts = pkt-pts;
  av_frame_set_pkt_pos (frame, pkt-pos);
  av_frame_set_pkt_duration(frame, pkt-duration);
 +av_frame_set_pkt_timebase(frame, avctx-time_base);
  av_frame_set_pkt_size(frame, pkt-size);

  /* copy the replaygain data to the output frame */
 @@ -776,6 +777,7 @@ int ff_init_buffer_info(AVCodecContext *avctx,
AVFrame *frame)
  frame-pkt_pts = AV_NOPTS_VALUE;
  av_frame_set_pkt_pos (frame, -1);
  av_frame_set_pkt_duration(frame, 0);
 +av_frame_set_pkt_timebase(frame, (AVRational){ 0, });
  av_frame_set_pkt_size(frame, -1);
  }
  frame-reordered_opaque = avctx-reordered_opaque;
 @@ -2063,6 +2065,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
  avpkt-size = 0;
  else if (!(avctx-codec-capabilities  CODEC_CAP_DELAY))
  avpkt-pts = avpkt-dts = frame-pts;
 +if (frame  av_frame_get_pkt_timebase(frame).num)
 +avpkt-duration =
av_rescale_q(av_frame_get_pkt_duration(frame),
 +
av_frame_get_pkt_timebase(frame),
 +   avctx-time_base);

  if (needs_realloc  avpkt-data) {
  ret = av_buffer_realloc(avpkt-buf, avpkt-size +
FF_INPUT_BUFFER_PADDING_SIZE);
 diff --git a/libavutil/frame.c b/libavutil/frame.c
 index fdfbc46..be60776 100644
 --- a/libavutil/frame.c
 +++ b/libavutil/frame.c
 @@ -29,6 +29,7 @@

  MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
 +MAKE_ACCESSORS(AVFrame, frame, AVRational, pkt_timebase)
  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
  MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
  MAKE_ACCESSORS(AVFrame, frame, int, channels)
 @@ -98,6 +99,7 @@ static void get_frame_defaults(AVFrame *frame)
  frame-pkt_pts   = AV_NOPTS_VALUE;
  av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
  av_frame_set_pkt_duration (frame, 0);
 +av_frame_set_pkt_timebase (frame, (AVRational){ 0, });
  av_frame_set_pkt_pos  (frame, -1);
  av_frame_set_pkt_size (frame, -1);
  frame-key_frame   = 1;
 @@ -475,6 +477,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame
*src)
  dst-pkt_pos= src-pkt_pos;
  dst-pkt_size   = src-pkt_size;
  dst-pkt_duration   = src-pkt_duration;
 +dst-pkt_timebase   = src-pkt_timebase;
  dst-reordered_opaque   = src-reordered_opaque;
  dst-quality= src-quality;
  dst-best_effort_timestamp  = src-best_effort_timestamp;
 diff --git a/libavutil/frame.h b/libavutil/frame.h
 index a39c8d0..954b765 100644
 --- a/libavutil/frame.h
 +++ b/libavutil/frame.h
 @@ -530,6 +530,15 @@ typedef struct AVFrame {
   * Not to be accessed directly from outside libavutil
   */
  AVBufferRef *qp_table_buf;
 +
 +/**
 + * timebase of the corresponding packet.
 + * Code outside libavcodec should access this field using:
 + * av_frame_get_pkt_timebase(frame)
 + * - encoding: unused
 + * - decoding: Read by user.
 + */
 +AVRational pkt_timebase;
  } AVFrame;

  /**
 @@ -541,6 +550,8 @@ int64_t av_frame_get_best_effort_timestamp(const
AVFrame *frame);
  voidav_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
  int64_t av_frame_get_pkt_duration (const AVFrame *frame);
  voidav_frame_set_pkt_duration (AVFrame *frame, int64_t val);
 +AVRational av_frame_get_pkt_timebase  (const AVFrame *frame);
 +voidav_frame_set_pkt_timebase (AVFrame *frame, AVRational
val);
  int64_t av_frame_get_pkt_pos  (const AVFrame *frame);
  voidav_frame_set_pkt_pos  (AVFrame *frame, int64_t val);
  int64_t av_frame_get_channel_layout   (const AVFrame *frame);
 --
 2.0.1.442.g7fe6834

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

Re: [FFmpeg-devel] [PATCH 3/4] smacker: remove dead code

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:04:05AM +0200, Paul B Mahol wrote:
 On Fri, Jul 18, 2014 at 4:25 AM, Timothy Gu timothyg...@gmail.com wrote:
 
  Signed-off-by: Timothy Gu timothyg...@gmail.com
  ---
   libavcodec/smacker.c | 2 --
   1 file changed, 2 deletions(-)
 
  diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
  index 644beb3..518bdad 100644
  --- a/libavcodec/smacker.c
  +++ b/libavcodec/smacker.c
  @@ -438,7 +438,6 @@ static int decode_frame(AVCodecContext *avctx, void
  *data, int *got_frame,
   bw = avctx-width  2;
   bh = avctx-height  2;
   blocks = bw * bh;
  -out = smk-pic-data[0];
   stride = smk-pic-linesize[0];
   while(blk  blocks) {
   int type, run, mode;
  @@ -499,7 +498,6 @@ static int decode_frame(AVCodecContext *avctx, void
  *data, int *got_frame,
   out += stride;
   out[0] = out[1] = pix  0xFF;
   out[2] = out[3] = pix  8;
  -out += stride;
 
 
 
  break;
   case 2:
   for(i = 0; i  2; i++) {
  --
  1.9.1
 
  ___
  ffmpeg-devel mailing list
  ffmpeg-devel@ffmpeg.org
  http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 
 
 lgtm

applied

thanks

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH] ffmpeg_filter: refuse to configure input without a decoder.

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:43:22AM +0200, Nicolas George wrote:
 The decoder is necessary in order to filter frames.
 This makes the error message clearer in this case:
 currently, it will usually fail because the pixel or sample
 format is not defined and is converted into (null)
 (non-portable).
 
 Signed-off-by: Nicolas George geo...@nsup.org
 ---
  ffmpeg_filter.c | 6 ++
  1 file changed, 6 insertions(+)

LGTM

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 12:56:17PM +0100, JULIAN GARDNER wrote:
 
  From: Clément Bœsch u...@pkh.me
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org 
 Sent: Friday, 18 July 2014, 13:38
 Subject: Re: [FFmpeg-devel] Filters
  
 
 On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
  How do I fix a filter so that it takes in 1 input but has no output, this 
  is part of a project and this part is a detection filter, it does nothing 
  else.
  
  The problem at the moment is that with the current filter, based on 
  drawbox, is that it produces an output which i need to the use overlay to 
  dump.
  
  Is there a video filter which has 1 input but 0 outputs
 
 Just make a passthrough filtering (ff_filter_frame(in)), and do not map
 its output
 
 
 
 Can you elaborate a bit more as I have this code as my base code
 
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 DrawBoxContext *s = inlink-dst-priv;
 int plane, x, y, xb = s-x, yb = s-y;
 unsigned char *row[4];
 
     // Detect Stationary Object
     
 
     // Here I would like to dump the frame as it is no longer needed
 
 return ff_filter_frame(inlink-dst-outputs[0], frame);
 }
 

You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -

There are a lot of detection only filters. volumedetect, signalstats,
blackdetect, ... just copy their behaviour

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread JULIAN GARDNER




- Original Message -
 From: Clément Bœsch u...@pkh.me
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Cc: 
 Sent: Friday, 18 July 2014, 14:01
 Subject: Re: [FFmpeg-devel] Filters
 
 On Fri, Jul 18, 2014 at 12:56:17PM +0100, JULIAN GARDNER wrote:
  
   From: Clément Bœsch u...@pkh.me
  To: FFmpeg development discussions and patches 
 ffmpeg-devel@ffmpeg.org 
  Sent: Friday, 18 July 2014, 13:38
  Subject: Re: [FFmpeg-devel] Filters
   
  
  On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
   How do I fix a filter so that it takes in 1 input but has no 
 output, this is part of a project and this part is a detection filter, it 
 does 
 nothing else.
   
   The problem at the moment is that with the current filter, based 
 on drawbox, is that it produces an output which i need to the use overlay to 
 dump.
   
   Is there a video filter which has 1 input but 0 outputs
  
  Just make a passthrough filtering (ff_filter_frame(in)), and do not map
  its output
  
 
 
  Can you elaborate a bit more as I have this code as my base code
 
 
  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
  {
  DrawBoxContext *s = inlink-dst-priv;
  int plane, x, y, xb = s-x, yb = s-y;
  unsigned char *row[4];
 
      // Detect Stationary Object
      
 
      // Here I would like to dump the frame as it is no longer needed
 
  return ff_filter_frame(inlink-dst-outputs[0], frame);
  }
 
 
 You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -
 
 There are a lot of detection only filters. volumedetect, signalstats,
 blackdetect, ... just copy their behaviour
 

Yes but this is my problem, an example command line I need at the moment

fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
 'split [mark], detection [dontneed];delay=5, markregion 
[vid];[dontneed][vid] overlay' -y -f mpegts processed.ts

What I would like

fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
 'split [mark], detection; delay=5, markregion' -y -f mpegts processed.ts

I am working on the delay filter at the moment, as i need 5 frames to detect 
the block, but i need to mark all frames, including the 4 previous frames. I am 
trying to get rid of the overlay as the input source could be HD.

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


Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: add alias expr_int_format to expansion function eif

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 07:53:48AM +0200, Stefano Sabatini wrote:
 On date Friday 2014-07-18 01:00:40 +0300, Andrey Utkin encoded:
  ---
   doc/filters.texi  | 2 +-
   libavfilter/vf_drawtext.c | 3 ++-
   2 files changed, 3 insertions(+), 2 deletions(-)
  
  diff --git a/doc/filters.texi b/doc/filters.texi
  index 8cde277..a7919a3 100644
  --- a/doc/filters.texi
  +++ b/doc/filters.texi
  @@ -3916,7 +3916,7 @@ example the text size is not known when evaluating 
  the expression, so
   the constants @var{text_w} and @var{text_h} will have an undefined
   value.
   
  -@item eif
  +@item expr_int_format, eif
   Evaluate the expression's value and output as formatted integer.
   
   First argument is expression to be evaluated, same as for @var{expr} 
  function.
  diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
  index c744d93..b7a295f 100644
  --- a/libavfilter/vf_drawtext.c
  +++ b/libavfilter/vf_drawtext.c
  @@ -949,7 +949,7 @@ static int func_eval_expr_int_format(AVFilterContext 
  *ctx, AVBPrint *bp,
   if (argc == 3) {
   ret = sscanf(argv[2], %u, positions);
   if (ret != 1) {
  -av_log(ctx, AV_LOG_ERROR, eif(): Invalid number of positions
  +av_log(ctx, AV_LOG_ERROR, expr_int_format(): Invalid number 
  of positions
to print: '%s'\n, argv[2]);
   return AVERROR(EINVAL);
   }
  @@ -982,6 +982,7 @@ static const struct drawtext_function {
   } functions[] = {
   { expr,  1, 1, 0,   func_eval_expr },
   { e, 1, 1, 0,   func_eval_expr },
  +{ expr_int_format, 2, 3, 0, func_eval_expr_int_format },
   { eif,   2, 3, 0,   func_eval_expr_int_format },
   { pict_type, 0, 0, 0,   func_pict_type },
   { pts,   0, 2, 0,   func_pts  },
 
 LGTM.

applied

thanks

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 01:14:25PM +0100, JULIAN GARDNER wrote:
[...]
  You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -
  
  There are a lot of detection only filters. volumedetect, signalstats,
  blackdetect, ... just copy their behaviour
  
 
 Yes but this is my problem, an example command line I need at the moment
 
 fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
  'split [mark], detection [dontneed];delay=5, markregion 
 [vid];[dontneed][vid] overlay' -y -f mpegts processed.ts
 
 What I would like
 
 fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
  'split [mark], detection; delay=5, markregion' -y -f mpegts processed.ts
 

Use -filter_complex and map only the output of markregion. Or maybe
just explicit [out0] after markregion with your -vf version, that might
work, I don't remember the details, but since I'm missing detection, delay
and markregion filter I have no idea how to test.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: correctly compute target duration

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:57:41AM +0200, Nicolas Martyanoff wrote:
 With HLS, the duration of all segments must be lower or equal to the target
 duration. Therefore floor(duration + 0.5) yields incorrect results.
 
 For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
 correct result is 2.0.
 ---
  libavformat/hlsenc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

this has already been applied by Anssi


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


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/segment: do not allow to create segments with no key-frames

2014-07-18 Thread Michael Niedermayer
On Thu, Jul 17, 2014 at 08:39:16PM +0200, Stefano Sabatini wrote:
 Fix trac ticket #3749.
 ---
  libavformat/segment.c | 16 +---
  1 file changed, 9 insertions(+), 7 deletions(-)

probably ok

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


[FFmpeg-devel] [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl, chunk).

2014-07-18 Thread Peter B.
Hello.

Georg Lippitsch and I created 2 FATE tests for the EBU Peak Envelope Chunk:
Test 1: Normal WAV file with levl-chunk and audio data.
Test 2: Peakfile WAV with levl-chunk, without audio data.

I tried to follow the style of existing lavf-regression tests in FATE as
good as possible.

Regards,
Pb
From bec0905cc5b896a287d8e0953c9931e41a62972d Mon Sep 17 00:00:00 2001
From: Peter B p...@das-werkstatt.com
Date: Thu, 17 Jul 2014 18:51:38 +0200
Subject: [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl
 chunk).

---
 tests/fate/avformat.mak  |2 ++
 tests/lavf-regression.sh |9 +
 tests/ref/lavf/wav_peak  |3 +++
 tests/ref/lavf/wav_peak_only |2 ++
 4 files changed, 16 insertions(+)
 create mode 100644 tests/ref/lavf/wav_peak
 create mode 100644 tests/ref/lavf/wav_peak_only

diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
index 5f9c8c1..1040afa 100644
--- a/tests/fate/avformat.mak
+++ b/tests/fate/avformat.mak
@@ -45,6 +45,8 @@ FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2,   MPEGTS) += ts
 FATE_LAVF-$(call ENCDEC,  PCM_U8,VOC)+= voc
 FATE_LAVF-$(call ENCDEC,  PCM_S16LE, VOC)+= voc_s16
 FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav
+FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav_peak
+FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav_peak_only
 FATE_LAVF-$(call ENCMUX,  PCM_S16LE, W64)+= w64
 FATE_LAVF-$(call ENCDEC,  MP2,   WTV)+= wtv
 FATE_LAVF-$(call ENCDEC,  XBM,   IMAGE2) += xbm
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index 0efbc9c..7e6ad06 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -274,6 +274,15 @@ if [ -n $do_wav ] ; then
 do_audio_only wav
 fi
 
+if [ -n $do_wav_peak ] ; then
+do_audio_only peak.wav  -write_peak on
+fi
+
+if [ -n $do_wav_peak_only ] ; then
+file=${outfile}lavf.peak_only.wav
+do_avconv $file $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -write_peak only
+fi
+
 if [ -n $do_alaw ] ; then
 do_audio_only al   -ar 44100
 fi
diff --git a/tests/ref/lavf/wav_peak b/tests/ref/lavf/wav_peak
new file mode 100644
index 000..aa7e5fc
--- /dev/null
+++ b/tests/ref/lavf/wav_peak
@@ -0,0 +1,3 @@
+35148d1f6e66b0080893851d917ecbf4 *./tests/data/lavf/lavf.peak.wav
+89094 ./tests/data/lavf/lavf.peak.wav
+./tests/data/lavf/lavf.peak.wav CRC=0x3a1da17e
diff --git a/tests/ref/lavf/wav_peak_only b/tests/ref/lavf/wav_peak_only
new file mode 100644
index 000..dccd0e7
--- /dev/null
+++ b/tests/ref/lavf/wav_peak_only
@@ -0,0 +1,2 @@
+b609a363e6d490710ed52231a8d09d3c *./tests/data/lavf/lavf.peak_only.wav
+832 ./tests/data/lavf/lavf.peak_only.wav
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH]Parse dri in rtp jpeg

2014-07-18 Thread Carl Eugen Hoyos
Hi!

Attached completely untested patch is based on the file attached to ticket 
#3780.

Please review, Carl Eugen
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 80fe295..ccd80ad 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -106,7 +106,8 @@ static void jpeg_put_marker(PutByteContext *pbc, int code)
 }
 
 static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t 
w,
-  uint32_t h, const uint8_t *qtable, int nb_qtable)
+  uint32_t h, const uint8_t *qtable, int nb_qtable,
+  int dri)
 {
 PutByteContext pbc;
 uint8_t *dht_size_ptr;
@@ -132,6 +133,12 @@ static int jpeg_create_header(uint8_t *buf, int size, 
uint32_t type, uint32_t w,
 bytestream2_put_byte(pbc, 0);
 bytestream2_put_byte(pbc, 0);
 
+if (dri) {
+jpeg_put_marker(pbc, DRI);
+bytestream2_put_be16(pbc, 4);
+bytestream2_put_be16(pbc, dri);
+}
+
 /* DQT */
 jpeg_put_marker(pbc, DQT);
 bytestream2_put_be16(pbc, 2 + nb_qtable * (1 + 64));
@@ -226,7 +233,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 const uint8_t *qtables = NULL;
 uint16_t qtable_len;
 uint32_t off;
-int ret;
+int ret, dri = 0;
 
 if (len  8) {
 av_log(ctx, AV_LOG_ERROR, Too short RTP/JPEG packet.\n);
@@ -242,6 +249,16 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 buf += 8;
 len -= 8;
 
+if (type  0x40) {
+if (len  4) {
+av_log(ctx, AV_LOG_ERROR, Too short RTP/JPEG packet.\n);
+return AVERROR_INVALIDDATA;
+}
+dri = AV_RB16(buf);
+buf += 4;
+len -= 4;
+type = ~0x40;
+}
 /* Parse the restart marker header. */
 if (type  63) {
 av_log(ctx, AV_LOG_ERROR,
@@ -332,7 +349,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
  * interchange format. */
 jpeg-hdr_size = jpeg_create_header(hdr, sizeof(hdr), type, width,
 height, qtables,
-qtable_len / 64);
+qtable_len / 64, dri);
 
 /* Copy JPEG header to frame buffer. */
 avio_write(jpeg-frame, hdr, jpeg-hdr_size);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Introduce avio_dump_contents() and use it in lavd/lavfi.c

2014-07-18 Thread Andrey Utkin
Thanks for comments, going to resubmit on Monday.

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


Re: [FFmpeg-devel] [PATCH] oss_audio: use a macro to simplify ioctl() error checking

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 02:56:16PM -0700, Timothy Gu wrote:
 Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
 available.
 
 Signed-off-by: Timothy Gu timothyg...@gmail.com
 ---
  libavdevice/oss_audio.c | 27 ++-
  1 file changed, 14 insertions(+), 13 deletions(-)

applied

thanks

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

No great genius has ever existed without some touch of madness. -- Aristotle


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