diff mbox series

[FFmpeg-devel,1/3] doc/examples/transcode: set packet timebase for decoding

Message ID 20230531153205.24424-1-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/3] doc/examples/transcode: set packet timebase for decoding | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov May 31, 2023, 3:32 p.m. UTC
It is recommended for callers to set it, though not required.
---
 doc/examples/transcode.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol May 31, 2023, 4:03 p.m. UTC | #1
LGTM
James Almer May 31, 2023, 7:02 p.m. UTC | #2
On 5/31/2023 12:32 PM, Anton Khirnov wrote:
> It is recommended for callers to set it, though not required.

Add this comment to the file. It's meant to be an example for library 
users to refer to for their implementations, after all.

> ---
>   doc/examples/transcode.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
> index 805a028ed7..7110816fe6 100644
> --- a/doc/examples/transcode.c
> +++ b/doc/examples/transcode.c
> @@ -97,6 +97,9 @@ static int open_input_file(const char *filename)
>                      "for stream #%u\n", i);
>               return ret;
>           }
> +
> +        codec_ctx->pkt_timebase = stream->time_base;
> +
>           /* Reencode video & audio and remux subtitles etc. */
>           if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO
>                   || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
Stefano Sabatini June 4, 2023, 2:29 p.m. UTC | #3
On date Wednesday 2023-05-31 16:02:13 -0300, James Almer wrote:
> On 5/31/2023 12:32 PM, Anton Khirnov wrote:
> > It is recommended for callers to set it, though not required.

> Add this comment to the file. It's meant to be an example for library users
> to refer to for their implementations, after all.

I think we should clarify the expectations (I had a similar local
patch to fix this, but I was unsatisfied with the current status quo
and I was exploring if it would be possible to fix this at the library
level - then I was sidetracked).
diff mbox series

Patch

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 805a028ed7..7110816fe6 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -97,6 +97,9 @@  static int open_input_file(const char *filename)
                    "for stream #%u\n", i);
             return ret;
         }
+
+        codec_ctx->pkt_timebase = stream->time_base;
+
         /* Reencode video & audio and remux subtitles etc. */
         if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO
                 || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {