[FFmpeg-devel] [PATCH] libavformat/tcp: fix return code for tcp_accept

2017-04-08 Thread Simon Thelen
ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
undefined), return ret instead and return ff_neterror() in
ff_poll_interrupt instead of AVERROR(errno) in case of Windows
shenanigans.
---
 libavformat/network.c | 2 +-
 libavformat/tcp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 2fb1c8b02a..b3987a4d11 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, 
int timeout,
 if (!ret)
 return AVERROR(ETIMEDOUT);
 if (ret < 0)
-return AVERROR(errno);
+return ff_neterrno(void);
 return ret;
 }
 
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 3055e48015..07b4ed9fa3 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
 cc = (*c)->priv_data;
 ret = ff_accept(sc->fd, sc->listen_timeout, s);
 if (ret < 0)
-return ff_neterrno();
+return ret;
 cc->fd = ret;
 return 0;
 }
-- 
2.12.2

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


[FFmpeg-devel] [PATCH v2] libavformat/tcp: fix return code for tcp_accept

2017-04-08 Thread Simon Thelen
ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
undefined), return ret instead and return ff_neterror() in
ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
Windows.
---
v2 rewords the commit message to better elucidate the issue.

 libavformat/network.c | 2 +-
 libavformat/tcp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 2fb1c8b02a..b3987a4d11 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, 
int timeout,
 if (!ret)
 return AVERROR(ETIMEDOUT);
 if (ret < 0)
-return AVERROR(errno);
+return ff_neterrno();
 return ret;
 }
 
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 3055e48015..07b4ed9fa3 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
 cc = (*c)->priv_data;
 ret = ff_accept(sc->fd, sc->listen_timeout, s);
 if (ret < 0)
-return ff_neterrno();
+return ret;
 cc->fd = ret;
 return 0;
 }
-- 
2.12.2

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


Re: [FFmpeg-devel] [PATCH v2] libavformat/tcp: fix return code for tcp_accept

2017-04-19 Thread Simon Thelen
On 17-04-08 at 14:21, Simon Thelen wrote:
> ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
> undefined), return ret instead and return ff_neterror() in
> ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
> Windows.
> ---
> v2 rewords the commit message to better elucidate the issue.
> 
>  libavformat/network.c | 2 +-
>  libavformat/tcp.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/network.c b/libavformat/network.c
> index 2fb1c8b02a..b3987a4d11 100644
> --- a/libavformat/network.c
> +++ b/libavformat/network.c
> @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t 
> nfds, int timeout,
>  if (!ret)
>  return AVERROR(ETIMEDOUT);
>  if (ret < 0)
> -return AVERROR(errno);
> +return ff_neterrno();
>  return ret;
>  }
>  
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index 3055e48015..07b4ed9fa3 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
>  cc = (*c)->priv_data;
>  ret = ff_accept(sc->fd, sc->listen_timeout, s);
>  if (ret < 0)
> -return ff_neterrno();
> +return ret;
>  cc->fd = ret;
>  return 0;
>  }
> -- 
> 2.12.2
> 
> _______
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

ping

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


Re: [FFmpeg-devel] [PATCH v2] libavformat/tcp: fix return code for tcp_accept

2017-05-08 Thread Simon Thelen
On 17-04-20 at 05:01, Simon Thelen wrote:
> On 17-04-08 at 14:21, Simon Thelen wrote:
> > ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
> > undefined), return ret instead and return ff_neterror() in
> > ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
> > Windows.
> > ---
> > v2 rewords the commit message to better elucidate the issue.
> > 
> >  libavformat/network.c | 2 +-
> >  libavformat/tcp.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/network.c b/libavformat/network.c
> > index 2fb1c8b02a..b3987a4d11 100644
> > --- a/libavformat/network.c
> > +++ b/libavformat/network.c
> > @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t 
> > nfds, int timeout,
> >  if (!ret)
> >  return AVERROR(ETIMEDOUT);
> >  if (ret < 0)
> > -return AVERROR(errno);
> > +return ff_neterrno();
> >  return ret;
> >  }
> >  
> > diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> > index 3055e48015..07b4ed9fa3 100644
> > --- a/libavformat/tcp.c
> > +++ b/libavformat/tcp.c
> > @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
> >  cc = (*c)->priv_data;
> >  ret = ff_accept(sc->fd, sc->listen_timeout, s);
> >  if (ret < 0)
> > -return ff_neterrno();
> > +return ret;
> >  cc->fd = ret;
> >  return 0;
> >  }
> > -- 
> > 2.12.2
> > 
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> ping
> 
ping?

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


[FFmpeg-devel] [PATCH 2/2] libavformat/segment: reindent

2016-10-08 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 libavformat/segment.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 82872fa..98e7bcc 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -69,8 +69,8 @@ typedef enum {
 LIST_TYPE_NB,
 } ListType;
 
-#define SEGMENT_LIST_FLAG_CACHE 1
-#define SEGMENT_LIST_FLAG_LIVE  2
+#define SEGMENT_LIST_FLAG_CACHE  1
+#define SEGMENT_LIST_FLAG_LIVE   2
 #define SEGMENT_LIST_FLAG_DELETE 4
 
 typedef struct SegmentContext {
@@ -460,8 +460,8 @@ static int segment_end(AVFormatContext *s, int 
write_trailer, int is_last)
 if ((ret = delete_old_segments(seg)) < 0)
 return ret;
 } else {
-av_freep(&entry->filename);
-av_freep(&entry);
+av_freep(&entry->filename);
+av_freep(&entry);
 }
 }
 
@@ -1060,9 +1060,9 @@ static const AVOption options[] = {
 { "segment_header_filename", "write a single file containing the header", 
OFFSET(header_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
 
 { "segment_list_flags","set flags affecting segment list generation", 
OFFSET(list_flags), AV_OPT_TYPE_FLAGS, {.i64 = SEGMENT_LIST_FLAG_CACHE }, 0, 
UINT_MAX, E, "list_flags"},
-{ "cache", "allow list caching",   
 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_CACHE }, INT_MIN, INT_MAX, 
  E, "list_flags"},
-{ "live",  "enable live-friendly list generation (useful for 
HLS)", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, 
INT_MAX,E, "list_flags"},
-{ "delete","delete segment files that are no longer part of 
the playlist", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_DELETE }, 
INT_MIN, INT_MAX,E, "list_flags"},
+{ "cache", "allow list caching",   
0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_CACHE }, INT_MIN, 
INT_MAX,  E, "list_flags"},
+{ "live",  "enable live-friendly list generation (useful for 
HLS)",0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, 
INT_MAX,   E, "list_flags"},
+{ "delete","delete segment files that are no longer part of 
the playlist", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_DELETE }, 
INT_MIN, INT_MAX, E, "list_flags"},
 
 { "segment_list_size", "set the maximum number of playlist entries", 
OFFSET(list_size), AV_OPT_TYPE_INT,  {.i64 = 0}, 0, INT_MAX, E },
 
-- 
2.10.0

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


[FFmpeg-devel] [PATCH 1/2] avformat/segment: add delete segment_list flag

2016-10-08 Thread Simon Thelen
Works in the same manner as the hls segment_delete flag.

Signed-off-by: Simon Thelen 
---
 doc/muxers.texi   |  5 +++
 libavformat/segment.c | 89 +++
 2 files changed, 94 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 9ec2e31..4002473 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1228,6 +1228,11 @@ Allow caching (only affects M3U8 list files).
 
 @item live
 Allow live-friendly file generation.
+
+@item delete
+Segment files removed from the playlist are deleted after a period of time
+equal to the duration of the segment plus the duration of the playlist.
+
 @end table
 
 @item segment_list_size @var{size}
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 33a5cf0..82872fa 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -26,8 +26,12 @@
 
 /* #define DEBUG */
 
+#include "config.h"
 #include 
 #include 
+#if HAVE_UNISTD_H
+#include 
+#endif
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -67,6 +71,7 @@ typedef enum {
 
 #define SEGMENT_LIST_FLAG_CACHE 1
 #define SEGMENT_LIST_FLAG_LIVE  2
+#define SEGMENT_LIST_FLAG_DELETE 4
 
 typedef struct SegmentContext {
 const AVClass *class;  /**< Class for private options. */
@@ -126,6 +131,7 @@ typedef struct SegmentContext {
 SegmentListEntry cur_entry;
 SegmentListEntry *segment_list_entries;
 SegmentListEntry *segment_list_entries_end;
+SegmentListEntry *segment_list_old;
 } SegmentContext;
 
 static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
@@ -144,6 +150,72 @@ static void print_csv_escaped_str(AVIOContext *ctx, const 
char *str)
 avio_w8(ctx, '"');
 }
 
+static int delete_old_segments(SegmentContext *seg)
+{
+SegmentListEntry *segment, *previous_segment = NULL;
+float playlist_duration = 0.0f;
+int ret = 0, path_size;
+char *dirname = NULL, *p;
+char *path = NULL;
+
+segment = seg->segment_list_entries;
+while (segment) {
+playlist_duration += segment->end_time - segment->start_time;
+segment = segment->next;
+}
+
+segment = seg->segment_list_old;
+while (segment) {
+playlist_duration -= segment->end_time - segment->start_time;
+previous_segment = segment;
+segment = previous_segment->next;
+if (playlist_duration <= -(previous_segment->end_time - 
previous_segment->start_time)) {
+previous_segment->next = NULL;
+break;
+}
+}
+
+if (segment) {
+dirname = av_strdup(seg->avf->filename);
+if (!dirname) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+p = (char *)av_basename(dirname);
+*p = '\0';
+}
+
+while (segment) {
+av_log(seg, AV_LOG_DEBUG, "deleting old segment %s\n",
+  segment->filename);
+path_size = strlen(dirname) + strlen(segment->filename) + 1;
+path = av_malloc(path_size);
+if (!path) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
+av_strlcpy(path, dirname, path_size);
+av_strlcat(path, segment->filename, path_size);
+if (unlink(path) < 0) {
+av_log(segment, AV_LOG_ERROR, "failed to delete old segment %s: 
%s\n",
+  path, strerror(errno));
+}
+av_freep(&path);
+previous_segment = segment;
+segment = previous_segment->next;
+av_freep(&previous_segment->filename);
+av_free(previous_segment);
+}
+
+fail:
+av_free(path);
+av_free(dirname);
+
+return ret;
+}
+
+
 static int segment_mux_init(AVFormatContext *s)
 {
 SegmentContext *seg = s->priv_data;
@@ -381,8 +453,16 @@ static int segment_end(AVFormatContext *s, int 
write_trailer, int is_last)
 if (seg->list_size && seg->segment_count >= seg->list_size) {
 entry = seg->segment_list_entries;
 seg->segment_list_entries = seg->segment_list_entries->next;
+if (entry && seg->list_flags & SEGMENT_LIST_FLAG_DELETE &&
+!seg->segment_idx_wrap) {
+entry->next = seg->segment_list_old;
+seg->segment_list_old = entry;
+if ((ret = delete_old_segments(seg)) < 0)
+return ret;
+} else {
 av_freep(&entry->filename);
 av_freep(&entry);
+}
 }
 
 if ((ret = segment_list_open(s)) < 0)
@@ -957,6 +1037,14 @@ fail:
 cur = next;
 }
 
+cur = seg->segment_list_old;
+while (cur) {
+next = cur->next;
+av_freep(&cu

[FFmpeg-devel] [PATCH] doc/ffmpeg: add documentation for the disposition option

2016-11-10 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 doc/ffmpeg.texi | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index fd8a0c1..4b159fd 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -357,6 +357,40 @@ To set the language of the first audio stream:
 ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT
 @end example
 
+@item -disposition[:stream_specifier] @var{value} (@emph{output,per-stream})
+Sets the disposition for a stream.
+
+This option overrides the disposition copied from the input stream. It is also
+possible to delete the disposition by setting it to 0.
+
+The following dispositions are recognized:
+@table @option
+@item default
+@item dub
+@item original
+@item comment
+@item lyrics
+@item karaoke
+@item forced
+@item hearing_impaired
+@item visual_impaired
+@item clean_effects
+@item captions
+@item descriptions
+@item metadata
+@end table
+
+For example, to make the second audio stream the default stream:
+@example
+ffmpeg -i in.mkv -disposition:a:1 default out.mkv
+@end example
+
+To make the second subtitle stream the default stream and remove the default
+disposition from the first subtitle stream:
+@example
+ffmpeg -i INPUT -disposition:s:0 0 -disposition:s:1 default OUTPUT
+@end example
+
 @item -program 
[title=@var{title}:][program_num=@var{program_num}:]st=@var{stream}[:st=@var{stream}...]
 (@emph{output})
 
 Creates a program with the specified @var{title}, @var{program_num} and adds 
the specified
-- 
2.10.2

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


[FFmpeg-devel] [PATCH] web/contact: Fix link.

2016-03-03 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 src/contact | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/contact b/src/contact
index 077f9ca..22c1e11 100644
--- a/src/contact
+++ b/src/contact
@@ -154,6 +154,6 @@
   
 http://ffmpeg.zeranoe.com/forum/";>FFmpeg on Windows
    
-http://ffmpeg.gusari.org/";>FFmpeg 
Support Forum
+http://ffmpeg.gusari.org/index.php";>FFmpeg Support Forum
   
  
-- 
2.7.1

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


Re: [FFmpeg-devel] [PATCH] web/contact: Fix link.

2016-03-03 Thread Simon Thelen
On 16-03-03 at 14:09, Michael Niedermayer wrote:
> On Thu, Mar 03, 2016 at 12:57:45PM +0100, Simon Thelen wrote:
> > Signed-off-by: Simon Thelen 
> > ---
> >  src/contact | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/contact b/src/contact
> > index 077f9ca..22c1e11 100644
> > --- a/src/contact
> > +++ b/src/contact
> > @@ -154,6 +154,6 @@
> >
> >   > href="http://ffmpeg.zeranoe.com/forum/";>FFmpeg on Windows
> >     
> > - > href="http://ffmpeg.gusari.org/";>FFmpeg Support Forum
> > + > href="http://ffmpeg.gusari.org/index.php";>FFmpeg Support Forum
> 
> i can apply this but shouldnt ffmpeg.gusari.org/ be fixed to redirect
> to that ?
Probably, but I don't know how to get in contact with someone who can do
that. There's already a post on the forum about it [1]. Plus linking
directly to index.php isn't wrong, and it's better than having the link
semi-404.

[1]: http://ffmpeg.gusari.org/viewtopic.php?f=3&t=2706

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] Merge commit '81306fd4bdeb5c17d4db771e4fec684773b5790f'

2016-03-13 Thread Simon Thelen
On 16-02-16 at 17:27, Derek Buitenhuis wrote:
> ffmpeg | branch: master | Derek Buitenhuis  | Tue 
> Feb 16 16:26:49 2016 +| [d0fc5de3a643fe7f974ed14e410c2ac2f4147d7e] | 
> committer: Derek Buitenhuis
> 
> Merge commit '81306fd4bdeb5c17d4db771e4fec684773b5790f'
> 
> * commit '81306fd4bdeb5c17d4db771e4fec684773b5790f':
>   hls: eliminate ffurl_* usage
> 
> Merged-by: Derek Buitenhuis 
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0fc5de3a643fe7f974ed14e410c2ac2f4147d7e
> ---
At least this change in hls.c seems to be incorrect, it breaks setting
the user-agent option for hls. Initially the correct user agent is used
when querying the hls, but when refreshing the playlist the user agent
is reset to Lavf/57.25.100. Reverting this specific hunk seems to fix
the issue. I assume the other changed call to update_options in open_url
is also broken, but didn't test.

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc1ff38..762e140 100644 (file)
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1513,7 +1486,7 @@ static int save_avio_options(AVFormatContext *s)

 static int hls_read_header(AVFormatContext *s)
 {
-URLContext *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb->opaque;
+void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb->opaque;
 HLSContext *c = s->priv_data;
 int ret = 0, i, j, stream_offset = 0;
 
@@ -1525,19 +1498,18 @@ static int hls_read_header(AVFormatContext *s)
 c->first_timestamp = AV_NOPTS_VALUE;
 c->cur_timestamp = AV_NOPTS_VALUE;
 
-// if the URL context is good, read important options we must broker later
-if (u && u->prot->priv_data_class) {
+if (u) {
 // get the previous user agent & set back to null if string size is 
zero
-update_options(&c->user_agent, "user-agent", u->priv_data);
+update_options(&c->user_agent, "user-agent", u);
 
 // get the previous cookies & set back to null if string size is zero
-update_options(&c->cookies, "cookies", u->priv_data);
+update_options(&c->cookies, "cookies", u);
 
 // get the previous headers & set back to null if string size is zero
-update_options(&c->headers, "headers", u->priv_data);
+update_options(&c->headers, "headers", u);
 
 // get the previous http proxt & set back to null if string size is 
zero
-update_options(&c->http_proxy, "http_proxy", u->priv_data);
+update_options(&c->http_proxy, "http_proxy", u);
 }
-- 
Simon Thelen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] Revert "hls: Add and use a memebr of AVIOInternal rather than abuse opaque"

2016-03-14 Thread Simon Thelen
Patchset also fixes the issues I've been experiencing.

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


Re: [FFmpeg-devel] [PATCH] delete the old segment file from hls list

2014-08-11 Thread Simon Thelen
On 11/08/14 at 17:39, Steven Liu wrote:
> Hi Guys,
Hello,
> 
> The FFmpeg hls module can make m3u8 and ts, but it dosen't delete the
> old ts segment file.
> If always run this module, the disk will full, so this patch can fix
> the problem.
> When update the segment list m3u8 file, it will delete the ts segment
> out range from the list file.
[..]
I'm pretty sure this is why the hls muxer has the `-hls_wrap wrap' option.

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


Re: [FFmpeg-devel] [PATCH] delete the old segment file from hls list

2014-08-12 Thread Simon Thelen
On 12/08/14 at 10:36, Steven Liu wrote:
> 2014-08-12 7:26 GMT+08:00 Simon Thelen :
> > On 11/08/14 at 17:39, Steven Liu wrote:
[..]
> > > The FFmpeg hls module can make m3u8 and ts, but it dosen't delete the
> > > old ts segment file.
> > > If always run this module, the disk will full, so this patch can fix
> > > the problem.
> > > When update the segment list m3u8 file, it will delete the ts segment
> > > out range from the list file.
> > [..]
> > I'm pretty sure this is why the hls muxer has the `-hls_wrap wrap' option.
[..]
>  hls_list_size and hls_wrap option two can fix the problem, but this
> patch can fix the problem of the default parameter, because the ts file on
> disk , one to one correspondence with the m3u8 file will better, isn't it?
IMO, the problem is that you're modifying the default behavior even
though an option already exists to let you specify the amount of segment
files to keep around. This might be suitable in your use-case, but what
if I (or someone else) wanted to keep all the segment files for archival
purposes, but not list them in the m3u8; with your patch this no longer
becomes possible.

If you were to write a new patch that made hls_wrap default to
hls_list_size instead of the default 0, it would no longer impose
artificial limits on users. At that point, the inclusion of the patch
would depend on the opinion of the hls maintainer and the other FFmpeg
maintainers with opinions on the matter.

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


[FFmpeg-devel] [PATCH] doc/filters: fix localtime drawtext example.

2014-09-09 Thread Simon Thelen
The colon after the localtime function call needs an additional layer of
escaping or else everything until the next colon is treated as a
fontfile.

Signed-off-by: Simon Thelen 
---
 doc/filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index bb486ea..5d49c5b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4185,7 +4185,7 @@ drawtext='fontfile=Linux Libertine 
O-40\:style=Semibold:text=FFmpeg'
 @item
 Print the date of a real-time encoding (see strftime(3)):
 @example
-drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
+drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
 @end example
 
 @item
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH] doc/filters: fix localtime drawtext example.

2014-09-10 Thread Simon Thelen
On 10/09/14 at 10:24, Nicolas George wrote:
> Le quartidi 24 fructidor, an CCXXII, Simon Thelen a écrit :
> > The colon after the localtime function call needs an additional layer of
> > escaping or else everything until the next colon is treated as a
> > fontfile.
> 
> The change looks ok, thanks. The commit message seems strange, though: I
> would have expected that the text starting at "%a" would be interpreted as
> options, not fontfile.
I'm not sure why it's being detected as a fontfile instead of as an
option either, but here are the error messages if you're interested:
[..]
[Parsed_drawtext_0 @ 0x2c02800] Could not load font "%a %b %d %Y}": cannot open 
resource
[Parsed_drawtext_0 @ 0x2c02800] Using "/usr/share/fonts/dejavu/DejaVuSans.ttf"
[..]
[Parsed_drawtext_0 @ 0x2c02800] Unterminated %{} near '{localtime'}'
[..]

And that was with this command line:
ffmpeg -i input.mp4 -vf 
drawtext='fontfile=/usr/share/fonts/dejavu/DejaVuSans.ttf:text=%{localtime:%a 
%b %d %Y}' out.mkv

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


Re: [FFmpeg-devel] [PATCH] doc/filters: fix localtime drawtext example.

2014-10-02 Thread Simon Thelen
On 10/09/14 at 00:01, Simon Thelen wrote:
> The colon after the localtime function call needs an additional layer of
> escaping or else everything until the next colon is treated as a
> fontfile.
> 
> Signed-off-by: Simon Thelen 
> ---
>  doc/filters.texi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index bb486ea..5d49c5b 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -4185,7 +4185,7 @@ drawtext='fontfile=Linux Libertine 
> O-40\:style=Semibold:text=FFmpeg'
>  @item
>  Print the date of a real-time encoding (see strftime(3)):
>  @example
> -drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
> +drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
>  @end example
>  
>  @item
> -- 
> 2.1.0
> 
Ping?

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


[FFmpeg-devel] [PATCH] ffmpeg_opt: add -seek_error option

2014-10-08 Thread Simon Thelen
Enabling -seek_error causes ffmpeg to quit when it notices that
stop_time <= start_time.

Closes ticket #4015.

Signed-off-by: Simon Thelen 
---
 doc/ffmpeg.texi | 4 
 ffmpeg_opt.c| 7 +++
 2 files changed, 11 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 4fc7682..4526605 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1144,6 +1144,10 @@ This option enables or disables accurate seeking in 
input files with the
 transcoding. Use @option{-noaccurate_seek} to disable it, which may be useful
 e.g. when copying some streams and transcoding the others.
 
+@item -seek_err (@emph{global})
+This option causes @command{ffmpeg} to error out instead of continuing when
+@option{-ss} is greater than @option{-to}. This option is disabled by default.
+
 @item -override_ffserver (@emph{global})
 Overrides the input specifications from @command{ffserver}. Using this
 option you can map any input stream to @command{ffserver} and control
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 10aaa3a..49d71c2 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -94,6 +94,7 @@ int copy_ts   = 0;
 int copy_tb   = -1;
 int debug_ts  = 0;
 int exit_on_error = 0;
+int seek_error= 0;
 int print_stats   = -1;
 int qp_hist   = 0;
 int stdin_interaction = 1;
@@ -1732,6 +1733,10 @@ static int open_output_file(OptionsContext *o, const 
char *filename)
 if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
 int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : 
o->start_time;
 if (o->stop_time <= start_time) {
+if (seek_error) {
+av_log(NULL, AV_LOG_ERROR, "-to value smaller than -ss; 
aborting.\n");
+exit_program(1);
+}
 av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring 
-to.\n");
 o->stop_time = INT64_MAX;
 } else {
@@ -2799,6 +2804,8 @@ const OptionDef options[] = {
 { "accurate_seek",  OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
 OPT_INPUT,   { .off = 
OFFSET(accurate_seek) },
 "enable/disable accurate seeking with -ss" },
+{ "seek_error", OPT_BOOL | OPT_EXPERT,   { 
&seek_error },
+"exit on seek errors" },
 { "itsoffset",  HAS_ARG | OPT_TIME | OPT_OFFSET |
 OPT_EXPERT | OPT_INPUT,  { .off = 
OFFSET(input_ts_offset) },
 "set the input ts offset", "time_off" },
-- 
2.1.2

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: add -seek_error option

2014-10-09 Thread Simon Thelen
On 09/10/14 at 23:05, Michael Niedermayer wrote:
> On Wed, Oct 08, 2014 at 07:13:33PM +0200, Simon Thelen wrote:
> > Enabling -seek_error causes ffmpeg to quit when it notices that
> > stop_time <= start_time.
> 
> is there a reason not to stop and continue ?
> iam asking as if not then this could be done unconditionally

I can't think of a reason as to why somebody would want to continue, but
I didn't want to mess with the default behavior so I thought a
conditional would be cleaner.
If you want, I can send another patch that makes exiting the default or
gets rid of the conditional entirely.

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: add -seek_error option

2014-10-10 Thread Simon Thelen
On 10/10/14 at 00:45, Michael Niedermayer wrote:
> On Thu, Oct 09, 2014 at 11:22:07PM +0200, Simon Thelen wrote:
> > On 09/10/14 at 23:05, Michael Niedermayer wrote:
> > > On Wed, Oct 08, 2014 at 07:13:33PM +0200, Simon Thelen wrote:
> > > > Enabling -seek_error causes ffmpeg to quit when it notices that
> > > > stop_time <= start_time.
> > > is there a reason not to stop and continue ?
> > > iam asking as if not then this could be done unconditionally
> > I can't think of a reason as to why somebody would want to continue, but
> > I didn't want to mess with the default behavior so I thought a
> > conditional would be cleaner.
> > If you want, I can send another patch that makes exiting the default or
> > gets rid of the conditional entirely.
> 
> well, its mostly a question what the community prefers
> personally id just make it fail if what the user wants cant be
> done, if noone has any other oppinion
 
I've attached a patch that makes ffmpeg abort in this case. If nobody
else has any opinions on the issue, you can commit that one.

-- 
Simon Thelen
>From edc569b9ea5aa1d2f2484d105ce090cfccbb76d9 Mon Sep 17 00:00:00 2001
From: Simon Thelen 
Date: Fri, 10 Oct 2014 23:04:01 +0200
Subject: [PATCH] ffmpeg_opt: abort if -to <= -ss

Makes ffmpeg abort instead of continuing when stop_time <= start_time.

Closes ticket #4015.

Signed-off-by: Simon Thelen 
---
 ffmpeg_opt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 10aaa3a..c518ae1 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1732,8 +1732,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
 if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
 int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : o->start_time;
 if (o->stop_time <= start_time) {
-av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring -to.\n");
-o->stop_time = INT64_MAX;
+av_log(NULL, AV_LOG_ERROR, "-to value smaller than -ss; aborting.\n");
+exit_program(1);
 } else {
 o->recording_time = o->stop_time - start_time;
 }
-- 
2.1.2

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


[FFmpeg-devel] [PATCH] avcodec/imgconvert: fix possible null pointer dereference

2018-04-03 Thread Simon Thelen
regression since 354b26a3945eadd4ed8fcd801dfefad2566241de
---
 libavcodec/imgconvert.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 7b0005b308..1fd636c83d 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -72,11 +72,12 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const 
enum AVPixelFormat *p
 int loss;
 
 for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) {
-loss = *loss_ptr;
+loss = loss_ptr ? *loss_ptr : 0;
 best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], 
src_pix_fmt, has_alpha, &loss);
 }
 
-*loss_ptr = loss;
+if (loss_ptr)
+*loss_ptr = loss;
 return best;
 }
 
-- 
2.16.3

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


[FFmpeg-devel] [PATCH] doc/filters: use '|' instead of ':' in the documentation.

2014-11-18 Thread Simon Thelen
Using colons to separate the outdefs is deprecated. Switch to using '|'
to separate the list items.

Signed-off-by: Simon Thelen 
---
 doc/filters.texi | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 53f4cb2..8c16c7a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1710,11 +1710,11 @@ The default is 0.707q and gives a Butterworth response.
 Mix channels with specific gain levels. The filter accepts the output
 channel layout followed by a set of channels definitions.
 
-This filter is also designed to remap efficiently the channels of an audio
+This filter is also designed to efficiently remap the channels of an audio
 stream.
 
 The filter accepts parameters of the form:
-"@var{l}:@var{outdef}:@var{outdef}:..."
+"@var{l}|@var{outdef}|@var{outdef}|..."
 
 @table @option
 @item l
@@ -1745,13 +1745,13 @@ avoiding clipping noise.
 For example, if you want to down-mix from stereo to mono, but with a bigger
 factor for the left channel:
 @example
-pan=1:c0=0.9*c0+0.1*c1
+pan=1c|c0=0.9*c0+0.1*c1
 @end example
 
 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
 7-channels surround:
 @example
-pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 
0.6*SR
+pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 
0.6*SR
 @end example
 
 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
@@ -1774,25 +1774,25 @@ remapping.
 For example, if you have a 5.1 source and want a stereo audio stream by
 dropping the extra channels:
 @example
-pan="stereo: c0=FL : c1=FR"
+pan="stereo| c0=FL | c1=FR"
 @end example
 
 Given the same source, you can also switch front left and front right channels
 and keep the input channel layout:
 @example
-pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
+pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
 @end example
 
 If the input is a stereo audio stream, you can mute the front left channel (and
 still keep the stereo channel layout) with:
 @example
-pan="stereo:c1=c1"
+pan="stereo|c1=c1"
 @end example
 
 Still with a stereo audio stream input, you can copy the right channel in both
 front left and right:
 @example
-pan="stereo: c0=FR : c1=FR"
+pan="stereo| c0=FR | c1=FR"
 @end example
 
 @section replaygain
-- 
2.1.3

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


[FFmpeg-devel] [PATCH] ffmpeg: add sdp_file option

2014-12-25 Thread Simon Thelen
Allow printing of sdp information to a file specified by -sdp_file
This allows users to print sdp information when at least one of the
outputs isn't an rtp stream.

Signed-off-by: Simon Thelen 
---
 ffmpeg.c | 30 --
 ffmpeg.h |  1 +
 ffmpeg_opt.c | 10 ++
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 9f29eac..46ea57b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2270,16 +2270,34 @@ static void print_sdp(void)
 {
 char sdp[16384];
 int i;
+int j;
+AVIOContext *sdp_pb;
 AVFormatContext **avc = av_malloc_array(nb_output_files, sizeof(*avc));
 
 if (!avc)
 exit_program(1);
-for (i = 0; i < nb_output_files; i++)
-avc[i] = output_files[i]->ctx;
+for (i = 0, j = 0; i < nb_output_files; i++) {
+if (!strcmp(output_files[i]->ctx->oformat->name, "rtp")) {
+avc[j] = output_files[i]->ctx;
+j++;
+}
+}
+
+av_sdp_create(avc, j, sdp, sizeof(sdp));
+
+if (!sdp_filename) {
+printf("SDP:\n%s\n", sdp);
+fflush(stdout);
+} else {
+if (avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL) 
< 0) {
+av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", 
sdp_filename);
+} else {
+avio_printf(sdp_pb, "SDP:\n%s", sdp);
+avio_close(sdp_pb);
+av_free(sdp_filename);
+}
+}
 
-av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp));
-printf("SDP:\n%s\n", sdp);
-fflush(stdout);
 av_freep(&avc);
 }
 
@@ -3122,7 +3140,7 @@ static int transcode_init(void)
 return ret;
 }
 
-if (want_sdp) {
+if (sdp_filename || want_sdp) {
 print_sdp();
 }
 
diff --git a/ffmpeg.h b/ffmpeg.h
index 117a35c..0ad1e37 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -470,6 +470,7 @@ extern FilterGraph **filtergraphs;
 extern intnb_filtergraphs;
 
 extern char *vstats_filename;
+extern char *sdp_filename;
 
 extern float audio_drift_threshold;
 extern float dts_delta_threshold;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ae05bf0..ac93eb5 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -77,6 +77,7 @@ const HWAccel hwaccels[] = {
 };
 
 char *vstats_filename;
+char *sdp_filename;
 
 float audio_drift_threshold = 0.1;
 float dts_delta_threshold   = 10;
@@ -381,6 +382,13 @@ static int opt_map_channel(void *optctx, const char *opt, 
const char *arg)
 return 0;
 }
 
+static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
+{
+av_free(sdp_filename);
+sdp_filename = av_strdup(arg);
+return 0;
+}
+
 /**
  * Parse a metadata specifier passed as 'arg' parameter.
  * @param arg  metadata string to parse
@@ -3070,6 +3078,8 @@ const OptionDef options[] = {
 "set the initial demux-decode delay", "seconds" },
 { "override_ffserver", OPT_BOOL | OPT_EXPERT | OPT_OUTPUT, { 
&override_ffserver },
 "override the options from ffserver", "" },
+{ "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { opt_sdp_file },
+"specify a file in which to print sdp information", "file" },
 
 { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off 
= OFFSET(bitstream_filters) },
 "A comma-separated list of bitstream filters", "bitstream_filters" },
-- 
2.2.1

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


[FFmpeg-devel] [PATCH] doc/ffmpeg.texi: document the new -sdp_file option

2014-12-28 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 doc/ffmpeg.texi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index d774aba..6de5004 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1160,6 +1160,11 @@ requested by @command{ffserver}.
 The option is intended for cases where features are needed that cannot be
 specified to @command{ffserver} but can be to @command{ffmpeg}.
 
+@item -sdp_file @var{file} (@emph{global})
+Print sdp information to @var{file}.
+This allows dumping sdp information when at least one output isn't an
+rtp stream.
+
 @item -discard (@emph{input})
 Allows discarding specific streams or frames of streams at the demuxer.
 Not all demuxers support this.
-- 
2.2.1

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


[FFmpeg-devel] [PATCH 0/2] Fix silent audio when channel layout specified with trailing c

2015-06-08 Thread Simon Thelen
When specifying the output channel layout with a trailing 'c' such as 
'1c' or '2c', the pad filter created silent output files. Leaving the
trailing 'c' away resulted in correct output files, but generated a
warning that the syntax was deprecated.

The first patch fixes two bugs in ff_parse_channel_layout including an
off-by-one and an issue in the parsing helper for unknown channel
layouts.

The second patch ensures that the channel layout is returned correctly
when FF_API_GET_CHANNEL_LAYOUT_COMPAT is set.

Simon Thelen (2):
  libavfilter/formats: Fix parsing of channel specifications with a
trailing 'c'.
  libavutil/channel_layout: Correctly return layout when channel
specification ends with a trailing 'c'.

 libavfilter/formats.c  | 19 ---
 libavutil/channel_layout.c |  2 +-
 2 files changed, 9 insertions(+), 12 deletions(-)

-- 
2.4.2

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


[FFmpeg-devel] [PATCH 2/2] libavutil/channel_layout: Correctly return layout when channel specification ends with a trailing 'c'.

2015-06-08 Thread Simon Thelen
Return layout when FF_API_GET_CHANNEL_LAYOUT_COMPAT is set even if the
layout itself is not in the deprecated style.

Signed-off-by: Simon Thelen 
---
 libavutil/channel_layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 4c0677f..cd5cf42 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -138,8 +138,8 @@ static uint64_t get_channel_layout_single(const char *name, 
int name_len)
"switch to the syntax '%.*sc' otherwise it will be 
interpreted as a "
"channel layout number in a later version\n",
name_len, name, name_len, name);
-return layout;
 }
+return layout;
 }
 } else {
 #endif
-- 
2.4.2

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


[FFmpeg-devel] [PATCH 1/2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.

2015-06-08 Thread Simon Thelen
Fix an off-by-one in checking tail for trailing characters and ensure
that the parsing helper is only called for unknown channel layouts.

Note: This removes the check ensuring that the channel layout is > 0 and
< 63.

Signed-off-by: Simon Thelen 
---
If the check ensuring 0 < chlayout < 63 is necessary, I can send a v2
adding it back

 libavfilter/formats.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 4f9773b..2e00f30 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -637,20 +637,17 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, 
const char *arg,
 void *log_ctx)
 {
 char *tail;
-int64_t chlayout, count;
-
-if (nret) {
-count = strtol(arg, &tail, 10);
-if (*tail == 'c' && !tail[1] && count > 0 && count < 63) {
-*nret = count;
-*ret = 0;
-return 0;
-}
-}
+int64_t chlayout;
+
 chlayout = av_get_channel_layout(arg);
 if (chlayout == 0) {
 chlayout = strtol(arg, &tail, 10);
-if (*tail || chlayout == 0) {
+if (*(tail + 1) || chlayout == 0) {
+if (nret && *tail == 'c') {
+*nret = chlayout;
+*ret = 0;
+return 0;
+}
 av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", 
arg);
 return AVERROR(EINVAL);
 }
-- 
2.4.2

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


Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.

2015-06-10 Thread Simon Thelen
On 15-06-09 at 22:50, Michael Niedermayer wrote:
> On Tue, Jun 09, 2015 at 04:55:56AM +0200, Simon Thelen wrote:
> > Fix an off-by-one in checking tail for trailing characters
> 
> > and ensure
> > that the parsing helper is only called for unknown channel layouts.
> 
> in which case does this make a difference / how can i reproduce the
> issue this fixes ?
For example:
ffmpeg -i stereo_audio.flac -af pan=1c|c0=0.9*c0+0.1*c1 out.wav
(Input and output file format don't matter)

Without this patch, this will produce silent audio.
> > 
> > Note: This removes the check ensuring that the channel layout is > 0 and
> > < 63.
> > 
> > Signed-off-by: Simon Thelen 
> > ---
> > If the check ensuring 0 < chlayout < 63 is necessary, I can send a v2
> > adding it back
> 
> i think its a good idea to keep the check or why shuld it be removed ?
I removed the check because a count <= 0 or >63 would have caused the
function to enter the bottom portion the same way it does now. Though,
if it only entered the function on count > 0, I could probably remove it
entirely because it only enters that portion of the code when strtol
returns 0. To be honest, I can't think of a valid reason for the
existence of that piece of code in the first place since it sets
out_channel_layout to 0 for valid input/output. If it were intended to
catch channel_layouts unknown to FFmpeg, it should have been placed
after the call to av_get_channel_layout, and not before it. (Note,
removing it does not cause any breakage on my end.)

> > 
> >  libavfilter/formats.c | 19 ---
> >  1 file changed, 8 insertions(+), 11 deletions(-)
> > 
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index 4f9773b..2e00f30 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -637,20 +637,17 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, 
> > const char *arg,
> >  void *log_ctx)
> >  {
> >  char *tail;
> > -int64_t chlayout, count;
> > -
> > -if (nret) {
> > -count = strtol(arg, &tail, 10);
> > -if (*tail == 'c' && !tail[1] && count > 0 && count < 63) {
> > -*nret = count;
> > -*ret = 0;
> > -return 0;
> > -}
> > -}
> > +int64_t chlayout;
> > +
> >  chlayout = av_get_channel_layout(arg);
> >  if (chlayout == 0) {
> >  chlayout = strtol(arg, &tail, 10);
> > -if (*tail || chlayout == 0) {
> > +if (*(tail + 1) || chlayout == 0) {
> 
> doesnt *(tail + 1) read from potentially after the array ?
Fixed in v2

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


[FFmpeg-devel] [PATCH v2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.

2015-06-10 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 libavfilter/formats.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 4f9773b..2d3b859 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -637,20 +637,12 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, 
const char *arg,
 void *log_ctx)
 {
 char *tail;
-int64_t chlayout, count;
-
-if (nret) {
-count = strtol(arg, &tail, 10);
-if (*tail == 'c' && !tail[1] && count > 0 && count < 63) {
-*nret = count;
-*ret = 0;
-return 0;
-}
-}
+int64_t chlayout;
+
 chlayout = av_get_channel_layout(arg);
 if (chlayout == 0) {
 chlayout = strtol(arg, &tail, 10);
-if (*tail || chlayout == 0) {
+if (!(*tail == '\0' || *tail == 'c' && *(tail + 1) == '\0') || 
chlayout == 0) {
 av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", 
arg);
 return AVERROR(EINVAL);
 }
-- 
2.4.2

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


Re: [FFmpeg-devel] [PATCH v2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.

2015-06-20 Thread Simon Thelen
On 15-06-20 at 14:31, Michael Niedermayer wrote:
> On Wed, Jun 10, 2015 at 07:55:52PM +0200, Simon Thelen wrote:
> > Signed-off-by: Simon Thelen 
> > ---
> >  libavfilter/formats.c | 14 +++---
> >  1 file changed, 3 insertions(+), 11 deletions(-)
> breaks fate
[..]
At least some if not all of those fate tests seem wrong to me.
Below I copy pasted the tests that fail with my patch below the
corresponding tests without the 'c' appended. To the best of my
knowledge, since the CHANNEL_LAYOUT_COMPAT layer hasn't been removed
channel layouts with the 'c' and channel layouts without the 'c' should
behave the same. This is not reflected in the current fate tests.

>0 = ff_parse_channel_layout(0004,  1, 1);
>0 = ff_parse_channel_layout(0003,  2, 2);
>0 = ff_parse_channel_layout(,  1, 1c);
>0 = ff_parse_channel_layout(,  2, 2c);
The bottom 2 should be modified so they match the top 2.

>0 = ff_parse_channel_layout(, 64, -1);
>-1 = ff_parse_channel_layout(, -1, -1c);

>0 = ff_parse_channel_layout(003C,  4, 60);
>0 = ff_parse_channel_layout(0041,  2, 65);
>0 = ff_parse_channel_layout(, 60, 60c);
>-1 = ff_parse_channel_layout(, -1, 65c);
I think the results for the tests with the 'c' should be correct for
these 2 blocks (At very least the test for -1c should be correct and the
test for -1 should be modified so the output matches).

I'll send a v3 of this patch that fails when chlayout is < 0 or > 63
along with a patch that updates the fate refs for the incorrect tests.
The patch for the refs assumes FF_API_GET_CHANNEL_LAYOUT_COMPAT is set,
if that defaults to unset/is removed the fate refs will need to be
updated (for all tests without the 'c' appended).


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


[FFmpeg-devel] [PATCH v3] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.

2015-06-20 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
:100644 100644 2451bf7... 8758b3d... M  libavfilter/formats.c
 libavfilter/formats.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 2451bf7..8758b3d 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -637,23 +637,20 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, 
const char *arg,
 void *log_ctx)
 {
 char *tail;
-int64_t chlayout, count;
+int64_t chlayout;
 
-if (nret) {
-count = strtol(arg, &tail, 10);
-if (*tail == 'c' && !tail[1] && count > 0 && count < 63) {
-*nret = count;
-*ret = 0;
-return 0;
-}
-}
 chlayout = av_get_channel_layout(arg);
 if (chlayout == 0) {
 chlayout = strtol(arg, &tail, 10);
-if (*tail || chlayout == 0) {
+if (!(*tail == '\0' || *tail == 'c' && *(tail + 1) == '\0') || 
chlayout <= 0 || chlayout > 63) {
 av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", 
arg);
 return AVERROR(EINVAL);
 }
+if (nret) {
+*nret = chlayout;
+*ret = 0;
+return 0;
+}
 }
 *ret = chlayout;
 if (nret)
-- 
2.4.3

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


[FFmpeg-devel] [PATCH] fate: update ref for avfilter/formats-test

2015-06-20 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
This patch assumes FF_API_GET_CHANNEL_LAYOUT_COMPAT is set,
if that defaults to unset/is removed the fate refs will need to be
updated (for all tests without the 'c' appended).

:100644 100644 0e21416... b0377e0... M  tests/ref/fate/filter-formats
 tests/ref/fate/filter-formats | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/ref/fate/filter-formats b/tests/ref/fate/filter-formats
index 0e21416..b0377e0 100644
--- a/tests/ref/fate/filter-formats
+++ b/tests/ref/fate/filter-formats
@@ -69,11 +69,11 @@ quad(side)
 -1 = ff_parse_channel_layout(, -1, blah);
 0 = ff_parse_channel_layout(0004,  1, 1);
 0 = ff_parse_channel_layout(0003,  2, 2);
-0 = ff_parse_channel_layout(, 64, -1);
-0 = ff_parse_channel_layout(003C,  4, 60);
-0 = ff_parse_channel_layout(0041,  2, 65);
-0 = ff_parse_channel_layout(,  1, 1c);
-0 = ff_parse_channel_layout(,  2, 2c);
+-1 = ff_parse_channel_layout(, -1, -1);
+0 = ff_parse_channel_layout(, 60, 60);
+-1 = ff_parse_channel_layout(, -1, 65);
+0 = ff_parse_channel_layout(0004,  1, 1c);
+0 = ff_parse_channel_layout(0003,  2, 2c);
 -1 = ff_parse_channel_layout(, -1, -1c);
 0 = ff_parse_channel_layout(, 60, 60c);
 -1 = ff_parse_channel_layout(, -1, 65c);
-- 
2.4.3

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


Re: [FFmpeg-devel] [PATCH] add CONTRIBUTING.md

2015-10-05 Thread Simon Thelen
On 15-10-05 at 15:26, Lou Logan wrote:
[..]
> +
> +**FFmpeg development, including patch reviews, occurs on the ffmpeg-devel
> +mailing list, so most developers do not view Github pull requests.
> +Therefore, Github pull requests should be avoided because they will
> +likely be not be noticed.**
likely not be noticed.

[..]

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


[FFmpeg-devel] [PATCH 0/2] Fix/clarify the sdp_file option.

2015-11-02 Thread Simon Thelen
Fixes a segfault when trying to write sdp information without an rtp
output stream, also clarifies that the sdp_file option requires an rtp
output format.

Example of segfaulting command:
ffmpeg -re -f lavfi -i testsrc -re -f lavfi -i aevalsrc=0 -sdp_file test -c:v 
libx264 -strict -2 -f rtp_mpegts rtp://localhost:

Simon Thelen (2):
  ffmpeg: Don't try and write sdp info if none of the outputs had an rtp
format.
  doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.

 doc/ffmpeg.texi | 4 ++--
 ffmpeg.c| 4 
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.6.2

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


[FFmpeg-devel] [PATCH 1/2] ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.

2015-11-02 Thread Simon Thelen
Fixes a segfault when trying to write nonexistent rtp information.

Signed-off-by: Simon Thelen 
---
 ffmpeg.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index f8b071a..a6b3c1c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2447,6 +2447,9 @@ static void print_sdp(void)
 }
 }
 
+   if (j == 0)
+   goto fail;
+
 av_sdp_create(avc, j, sdp, sizeof(sdp));
 
 if (!sdp_filename) {
@@ -2462,6 +2465,7 @@ static void print_sdp(void)
 }
 }
 
+fail:
 av_freep(&avc);
 }
 
-- 
2.6.2

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


[FFmpeg-devel] [PATCH 2/2] doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.

2015-11-02 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 doc/ffmpeg.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 08b1ed2..cf74734 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1233,9 +1233,9 @@ The option is intended for cases where features are 
needed that cannot be
 specified to @command{ffserver} but can be to @command{ffmpeg}.
 
 @item -sdp_file @var{file} (@emph{global})
-Print sdp information to @var{file}.
+Print sdp information for an output stream to @var{file}.
 This allows dumping sdp information when at least one output isn't an
-rtp stream.
+rtp stream. (Requires at least one of the output formats to be rtp).
 
 @item -discard (@emph{input})
 Allows discarding specific streams or frames of streams at the demuxer.
-- 
2.6.2

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


[FFmpeg-devel] [PATCH 1/2 v2] ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.

2015-11-02 Thread Simon Thelen
Fixes a segfault when trying to write nonexistent rtp information.

Signed-off-by: Simon Thelen 
---
 ffmpeg.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index f8b071a..6b41bb3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2447,6 +2447,9 @@ static void print_sdp(void)
 }
 }
 
+if (!j)
+goto fail;
+
 av_sdp_create(avc, j, sdp, sizeof(sdp));
 
 if (!sdp_filename) {
@@ -2462,6 +2465,7 @@ static void print_sdp(void)
 }
 }
 
+fail:
 av_freep(&avc);
 }
 
-- 
2.6.2

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


Re: [FFmpeg-devel] [PATCH 1/2] ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.

2015-11-02 Thread Simon Thelen
On 15-11-02 at 15:09, Carl Eugen Hoyos wrote:
> Simon Thelen  c-14.de> writes:
> 
> > +   if (j == 0)
> > +   goto fail;
> 
> Tabs cannot be committed to our repository, please 
> remove them (this has to be fixed).
> Most FFmpeg code uses "if (!j)", feel free to ignore.
Looks like my gitconfig for ffmpeg lost the warn for tab-in-indent.
fixed in v2.

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


Re: [FFmpeg-devel] [PATCH 0/2] Fix/clarify the sdp_file option.

2015-11-09 Thread Simon Thelen
On 15-11-02 at 15:57, Simon Thelen wrote:
> Fixes a segfault when trying to write sdp information without an rtp
> output stream, also clarifies that the sdp_file option requires an rtp
> output format.
> 
> Example of segfaulting command:
> ffmpeg -re -f lavfi -i testsrc -re -f lavfi -i aevalsrc=0 -sdp_file test -c:v 
> libx264 -strict -2 -f rtp_mpegts rtp://localhost:5555
> 
> Simon Thelen (2):
>   ffmpeg: Don't try and write sdp info if none of the outputs had an rtp
> format.
>   doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.
> 
>  doc/ffmpeg.texi | 4 ++--
>  ffmpeg.c| 4 
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> -- 
> 2.6.2

ping
These should probably also be backported to 2.8

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


[FFmpeg-devel] [PATCH] ffmpeg: When streamcopying, only add the input seek position when copying timestamps.

2015-11-22 Thread Simon Thelen
Using -ss as an input option shifts timestamps down by the seek, so it
doesn't have to be added to the recording time when checking whether to
stop.

Fixes #977

Signed-off-by: Simon Thelen 
---
 ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index bf5e983..6658fb2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1831,7 +1831,7 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
 
 if (f->recording_time != INT64_MAX) {
 start_time = f->ctx->start_time;
-if (f->start_time != AV_NOPTS_VALUE)
+if (f->start_time != AV_NOPTS_VALUE && copy_ts)
 start_time += f->start_time;
 if (ist->pts >= f->recording_time + start_time) {
 close_output_stream(ost);
-- 
2.6.3

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: When streamcopying, only add the input seek position when copying timestamps.

2015-11-29 Thread Simon Thelen
On 15-11-22 at 15:03, Simon Thelen wrote:
> Using -ss as an input option shifts timestamps down by the seek, so it
> doesn't have to be added to the recording time when checking whether to
> stop.
> 
> Fixes #977
> 
> Signed-off-by: Simon Thelen 
> ---
>  ffmpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index bf5e983..6658fb2 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1831,7 +1831,7 @@ static void do_streamcopy(InputStream *ist, 
> OutputStream *ost, const AVPacket *p
>  
>  if (f->recording_time != INT64_MAX) {
>  start_time = f->ctx->start_time;
> -if (f->start_time != AV_NOPTS_VALUE)
> +if (f->start_time != AV_NOPTS_VALUE && copy_ts)
>  start_time += f->start_time;
>  if (ist->pts >= f->recording_time + start_time) {
>  close_output_stream(ost);
> -- 
> 2.6.3
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

ping

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


[FFmpeg-devel] [PATCH] fate: add limited_input_seek tests

2015-12-05 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 tests/fate/ffmpeg.mak| 6 ++
 tests/ref/fate/limited_input_seek| 1 +
 tests/ref/fate/limited_input_seek-copyts | 1 +
 3 files changed, 8 insertions(+)
 create mode 100644 tests/ref/fate/limited_input_seek
 create mode 100644 tests/ref/fate/limited_input_seek-copyts

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 551d8e7..2061cd7 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -46,3 +46,9 @@ fate-unknown_layout-ac3: $(AREF)
 fate-unknown_layout-ac3: CMD = md5 \
   -guess_layout_max 0 -f s16le -ac 1 -ar 44100 -i $(TARGET_PATH)/$(AREF) \
   -f ac3 -flags +bitexact -c ac3_fixed
+
+FATE_SAMPLES_FFMPEG-$(call DEMMUX, OGG, OGG) += fate-limited_input_seek 
fate-limited_input_seek-copyts
+fate-limited_input_seek: $(TARGET_SAMPLES)/vorbis/moog_small.ogg
+fate-limited_input_seek: CMD = md5 -ss 1.5 -t 1.3 -i 
$(TARGET_SAMPLES)/vorbis/moog_small.ogg -c:a copy -fflags +bitexact -f ogg
+fate-limited_input_seek-copyts: $(TARGET_SAMPLES)/vorbis/moog_small.ogg
+fate-limited_input_seek-copyts: CMD = md5 -ss 1.5 -t 1.3 -i 
$(TARGET_SAMPLES)/vorbis/moog_small.ogg -c:a copy -copyts -fflags +bitexact -f 
ogg
diff --git a/tests/ref/fate/limited_input_seek 
b/tests/ref/fate/limited_input_seek
new file mode 100644
index 000..e0c4bf1
--- /dev/null
+++ b/tests/ref/fate/limited_input_seek
@@ -0,0 +1 @@
+20a1bb9a1cfb23c1fe86f14e6065cd95
diff --git a/tests/ref/fate/limited_input_seek-copyts 
b/tests/ref/fate/limited_input_seek-copyts
new file mode 100644
index 000..92790a8
--- /dev/null
+++ b/tests/ref/fate/limited_input_seek-copyts
@@ -0,0 +1 @@
+ec3604b1954ed80de364b8ef491771ce
-- 
2.6.3

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


[FFmpeg-devel] [PATCH] lavf/webvttenc: Require webvtt file to contain exactly one WebVTT stream.

2015-09-11 Thread Simon Thelen
Not requiring this can end up producing hilariously broken files
together with -c:s copy (e.g. a webvtt file containing binary subtitle data).

Signed-off-by: Simon Thelen 
---
 libavformat/webvttenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index b93993d..c386538 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -46,8 +46,14 @@ static void webvtt_write_time(AVIOContext *pb, int64_t 
millisec)
 static int webvtt_write_header(AVFormatContext *ctx)
 {
 AVStream *s = ctx->streams[0];
+AVCodecContext *avctx = ctx->streams[0]->codec;
 AVIOContext *pb = ctx->pb;
 
+if (ctx->nb_streams != 1 || avctx->codec_id != AV_CODEC_ID_WEBVTT) {
+av_log(ctx, AV_LOG_ERROR, "Exactly one WebVTT stream is needed.\n");
+return AVERROR(EINVAL);
+}
+
 avpriv_set_pts_info(s, 64, 1, 1000);
 
 avio_printf(pb, "WEBVTT\n");
-- 
2.5.1

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


[FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec

2015-04-15 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
Implemented like the check for libx264 without the warn on fallback. Tested on 
my system with pkg-config.
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 389de92..1d98828 100755
--- a/configure
+++ b/configure
@@ -5012,7 +5012,8 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
-enabled libdcadec && require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec
+enabled libdcadec && { use_pkg_config dcadec libdcadec/dca_context.h 
dcadec_context_create ||
+   { require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec; }; }
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
-- 
2.3.5

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


Re: [FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec

2015-04-15 Thread Simon Thelen
On 15-04-15 at 14:03, James Almer wrote:
> On 15/04/15 2:00 PM, wm4 wrote:
> > On Wed, 15 Apr 2015 17:18:58 +0200
> > Simon Thelen  wrote:
> >> Signed-off-by: Simon Thelen 
[..]
> > Isn't the fallback not needed anymore?
> Yeah, the pkg-config check alone is enough.
> There's currently no release out using this wrapper, or any distro whatsoever 
> shipping 
> the library in question for that matter, so it can be safely removed without 
> being 
> considered a change of behavior.
I don't particularly mind either way. I can resend a version without
fallback.

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


[FFmpeg-devel] [PATCH] configure: use pkg-config to find libdcadec

2015-04-15 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 389de92..93aebcb 100755
--- a/configure
+++ b/configure
@@ -5012,7 +5012,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
-enabled libdcadec && require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec
+enabled libdcadec && require_pkg_config dcadec libdcadec/dca_context.h 
dcadec_context_create
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
-- 
2.3.5

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


[FFmpeg-devel] [PATCH] libavformat/segment: change segment_list_size behavior to match hls_list_size behavior.

2014-07-09 Thread Simon Thelen
Make the segment muxer keep segment_list_size segments instead of
segment_list_size + 1 segments. This patch also changes the
documentation for segment_list_size to reduce possible confusion over
how many segments are kept.

Signed-off-by: Simon Thelen 
---
 doc/muxers.texi   | 2 +-
 libavformat/segment.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index dc2a08b..7bf47a2 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -822,7 +822,7 @@ Select the listing format.
 @end table
 
 @item segment_list_size @var{size}
-Update the list file so that it contains at most the last @var{size}
+Update the list file so that it contains at most @var{size}
 segments. If 0 the list file will contain all the segments. Default
 value is 0.
 
diff --git a/libavformat/segment.c b/libavformat/segment.c
index f5e25a2..623b076 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -333,7 +333,7 @@ static int segment_end(AVFormatContext *s, int 
write_trailer, int is_last)
 seg->segment_list_entries_end = entry;
 
 /* drop first item */
-if (seg->list_size && seg->segment_count > seg->list_size) {
+if (seg->list_size && seg->segment_count >= seg->list_size) {
 entry = seg->segment_list_entries;
 seg->segment_list_entries = seg->segment_list_entries->next;
 av_free(entry->filename);
-- 
2.0.0

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


Re: [FFmpeg-devel] [PATCH] libavformat/segment: change segment_list_size behavior to match hls_list_size behavior.

2014-07-09 Thread Simon Thelen
On 09/07/14 at 21:40, Simon Thelen wrote:
> Make the segment muxer keep segment_list_size segments instead of
> segment_list_size + 1 segments. This patch also changes the
> documentation for segment_list_size to reduce possible confusion over
> how many segments are kept.
What I forgot to mention was that this allows the segment list to
be limited to containing only one segment which used to be impossible
because a segment_list_size of 0 kept all the segments and a
segment_list_size of 1 kept 2 segments. I can add that to the commit
message if you want.

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