Re: [FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-05 Thread wm4
On Tue, 4 Oct 2016 20:26:49 +0200
Michael Niedermayer  wrote:

> On Tue, Oct 04, 2016 at 06:33:48PM +0200, wm4 wrote:
> > Some API users (in particular ffmpeg.c) check the best effort timestamp
> > only.
> > ---
> > Using guess_correct_pts() - not sure what I was thinking.
> > ---
> >  libavcodec/utils.c | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)  
> 
> LGTM
> 
> thx
> 
> [...]

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


Re: [FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-04 Thread Michael Niedermayer
On Tue, Oct 04, 2016 at 06:33:48PM +0200, wm4 wrote:
> Some API users (in particular ffmpeg.c) check the best effort timestamp
> only.
> ---
> Using guess_correct_pts() - not sure what I was thinking.
> ---
>  libavcodec/utils.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)

LGTM

thx

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


[FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-04 Thread wm4
Some API users (in particular ffmpeg.c) check the best effort timestamp
only.
---
Using guess_correct_pts() - not sure what I was thinking.
---
 libavcodec/utils.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ef3da65..9f8f9c7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2867,7 +2867,14 @@ int attribute_align_arg 
avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
 if (avctx->codec->receive_frame) {
 if (avctx->internal->draining && !(avctx->codec->capabilities & 
AV_CODEC_CAP_DELAY))
 return AVERROR_EOF;
-return avctx->codec->receive_frame(avctx, frame);
+ret = avctx->codec->receive_frame(avctx, frame);
+if (ret >= 0) {
+if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE) {
+av_frame_set_best_effort_timestamp(frame,
+guess_correct_pts(avctx, frame->pkt_pts, frame->pkt_dts));
+}
+}
+return ret;
 }
 
 // Emulation via old API.
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-04 Thread Michael Niedermayer
On Sun, Oct 02, 2016 at 06:56:48PM +0200, wm4 wrote:
> Some API users (in particular ffmpeg.c) check the best effort timestamp
> only.
> ---
> Still undecided if this is the right approach.
> ---
>  libavcodec/utils.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index ef3da65..1875a69 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2867,7 +2867,12 @@ int attribute_align_arg 
> avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
>  if (avctx->codec->receive_frame) {
>  if (avctx->internal->draining && !(avctx->codec->capabilities & 
> AV_CODEC_CAP_DELAY))
>  return AVERROR_EOF;
> -return avctx->codec->receive_frame(avctx, frame);
> +ret = avctx->codec->receive_frame(avctx, frame);
> +if (ret >= 0) {
> +if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE)
> +av_frame_set_best_effort_timestamp(frame, frame->pkt_pts);

i think the pkt_dts should be considered as well if available
as in/with guess_correct_pts()

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

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


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


Re: [FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-03 Thread Timo Rothenpieler
On 10/2/2016 6:56 PM, wm4 wrote:
> Some API users (in particular ffmpeg.c) check the best effort timestamp
> only.
> ---
> Still undecided if this is the right approach.
> ---
>  libavcodec/utils.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index ef3da65..1875a69 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2867,7 +2867,12 @@ int attribute_align_arg 
> avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
>  if (avctx->codec->receive_frame) {
>  if (avctx->internal->draining && !(avctx->codec->capabilities & 
> AV_CODEC_CAP_DELAY))
>  return AVERROR_EOF;
> -return avctx->codec->receive_frame(avctx, frame);
> +ret = avctx->codec->receive_frame(avctx, frame);
> +if (ret >= 0) {
> +if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE)
> +av_frame_set_best_effort_timestamp(frame, frame->pkt_pts);
> +}
> +return ret;
>  }
>  
>  // Emulation via old API.
> 

+1 from me.
Not a single decoder sets this, and requiring it for the new API seems a
bit strange.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-02 Thread wm4
Some API users (in particular ffmpeg.c) check the best effort timestamp
only.
---
Still undecided if this is the right approach.
---
 libavcodec/utils.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ef3da65..1875a69 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2867,7 +2867,12 @@ int attribute_align_arg 
avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
 if (avctx->codec->receive_frame) {
 if (avctx->internal->draining && !(avctx->codec->capabilities & 
AV_CODEC_CAP_DELAY))
 return AVERROR_EOF;
-return avctx->codec->receive_frame(avctx, frame);
+ret = avctx->codec->receive_frame(avctx, frame);
+if (ret >= 0) {
+if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE)
+av_frame_set_best_effort_timestamp(frame, frame->pkt_pts);
+}
+return ret;
 }
 
 // Emulation via old API.
-- 
2.9.3

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