Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-12-03 Thread Stefano Sabatini
On date Friday 2015-11-27 19:16:06 +0100, Nicolas George encoded:
> Signed-off-by: Nicolas George 
> ---
>  libavformat/internal.h | 6 ++
>  libavformat/utils.c| 5 +
>  2 files changed, 11 insertions(+)
> 
> 
> Apparently, the most unhappyness was caused by the error code in the public
> API. This is not the case here.
> 
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index ee86094..0f684bd 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, 
> AVFormatContext *src);
>  int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const 
> char *url, int flags,
> const AVIOInterruptCB *int_cb, AVDictionary 
> **options);
>  
> +/**
> + * Returned by demuxers to indicate that data was consumed but discarded
> + * (ignored streams or junk data). The framework will re-call the demuxer.
> + */
> +#define FFERROR_REDO FFERRTAG( 'R','E','D','O')
> +
>  #endif /* AVFORMAT_INTERNAL_H */
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 8cb7d38..83e2f73 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  av_init_packet(pkt);
>  ret = s->iformat->read_packet(s, pkt);
>  if (ret < 0) {
> +/* Some demuxer (FLV, MPEG-PS) return FFERROR_REDO when they
> +   data and discard it (ignored streams, junk, extradata).
> +   We must re-call the demuxer to get the real packet. */
> +if (ret == FFERROR_REDO)
> +continue;

LGTM with the changes suggested in the other comments. In particular:

/* Some demuxers return FFERROR_REDO when they provide
   data and discard it (ignored streams, junk, extradata).
   We must re-call the demuxer to get the real packet. */

Thanks.
-- 
FFmpeg = Frightening Forgiving Marvellous Powered Exxagerate Gorilla
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-11-28 Thread Nicolas George
Le septidi 7 frimaire, an CCXXIV, Clement Boesch a écrit :
> "returned internally by demuxers" maybe

That sounds to me like an oxymoron. IMHO, being in internal.h and named
FFERROR instead of AVERROR should be enough (even separately).

> nit: space issue

Locally fixed.

> when they data?

Locally amended to:

/* Some demuxer return FFERROR_REDO when they consume
   data and discard it (ignored streams, junk, extradata).
   We must re-call the demuxer to get the real packet. */

And locally changed "demuxers" to plural in the commit message.

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 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-11-28 Thread Clément Bœsch
On Sat, Nov 28, 2015 at 09:08:52AM +0100, Nicolas George wrote:
> Le septidi 7 frimaire, an CCXXIV, Clement Boesch a écrit :
> > "returned internally by demuxers" maybe
> 
> That sounds to me like an oxymoron. IMHO, being in internal.h and named
> FFERROR instead of AVERROR should be enough (even separately).
> 

ok

> > nit: space issue
> 
> Locally fixed.
> 
> > when they data?
> 
> Locally amended to:
> 
> /* Some demuxer return FFERROR_REDO when they consume
>data and discard it (ignored streams, junk, extradata).
>We must re-call the demuxer to get the real packet. */
> 
> And locally changed "demuxers" to plural in the commit message.
> 

but not in the beginning of the sentence above?

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-11-27 Thread Clément Bœsch
On Fri, Nov 27, 2015 at 07:16:06PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George 
> ---
>  libavformat/internal.h | 6 ++
>  libavformat/utils.c| 5 +
>  2 files changed, 11 insertions(+)
> 
> 
> Apparently, the most unhappyness was caused by the error code in the public
> API. This is not the case here.
> 
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index ee86094..0f684bd 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, 
> AVFormatContext *src);
>  int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const 
> char *url, int flags,
> const AVIOInterruptCB *int_cb, AVDictionary 
> **options);
>  
> +/**
> + * Returned by demuxers to indicate that data was consumed but discarded

"returned internally by demuxers" maybe

> + * (ignored streams or junk data). The framework will re-call the demuxer.
> + */
> +#define FFERROR_REDO FFERRTAG( 'R','E','D','O')

nit: space issue

> +
>  #endif /* AVFORMAT_INTERNAL_H */
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 8cb7d38..83e2f73 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  av_init_packet(pkt);
>  ret = s->iformat->read_packet(s, pkt);
>  if (ret < 0) {
> +/* Some demuxer (FLV, MPEG-PS) return FFERROR_REDO when they
> +   data and discard it (ignored streams, junk, extradata).

when they data?

[...]

otherwise this is fine with me that way

-- 
Clément B.


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


[FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-11-27 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavformat/internal.h | 6 ++
 libavformat/utils.c| 5 +
 2 files changed, 11 insertions(+)


Apparently, the most unhappyness was caused by the error code in the public
API. This is not the case here.


diff --git a/libavformat/internal.h b/libavformat/internal.h
index ee86094..0f684bd 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, 
AVFormatContext *src);
 int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char 
*url, int flags,
const AVIOInterruptCB *int_cb, AVDictionary **options);
 
+/**
+ * Returned by demuxers to indicate that data was consumed but discarded
+ * (ignored streams or junk data). The framework will re-call the demuxer.
+ */
+#define FFERROR_REDO FFERRTAG( 'R','E','D','O')
+
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8cb7d38..83e2f73 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 av_init_packet(pkt);
 ret = s->iformat->read_packet(s, pkt);
 if (ret < 0) {
+/* Some demuxer (FLV, MPEG-PS) return FFERROR_REDO when they
+   data and discard it (ignored streams, junk, extradata).
+   We must re-call the demuxer to get the real packet. */
+if (ret == FFERROR_REDO)
+continue;
 if (!pktl || ret == AVERROR(EAGAIN))
 return ret;
 for (i = 0; i < s->nb_streams; i++) {
-- 
2.6.2

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