Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
@ 2025-08-04 19:50 Pavel Koshevoy
  2025-08-07 12:14 ` Pavel Koshevoy
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pavel Koshevoy @ 2025-08-04 19:50 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Pavel Koshevoy

---
 libavcodec/mfenc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index 30531fe3e8..942c75cb9d 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext *avctx, IMFSample *sample)
     return mf_from_mf_time(avctx, pts);
 }
 
+static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample *sample)
+{
+    LONGLONG duration;
+    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
+    if (FAILED(hr))
+        return 0;
+    return mf_from_mf_time(avctx, duration);
+}
+
 static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType *type)
 {
     MFContext *c = avctx->priv_data;
@@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext *avctx, IMFSample *sample, AVPac
     IMFMediaBuffer_Release(buffer);
 
     avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
+    avpkt->duration = mf_sample_get_duration(avctx, sample);
 
     hr = IMFAttributes_GetUINT32(sample, &MFSampleExtension_CleanPoint, &t32);
     if (c->is_audio || (!FAILED(hr) && t32 != 0))
-- 
2.43.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
  2025-08-04 19:50 [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration Pavel Koshevoy
@ 2025-08-07 12:14 ` Pavel Koshevoy
  2025-08-12 13:56 ` Pavel Koshevoy
  2025-08-12 13:58 ` James Almer
  2 siblings, 0 replies; 6+ messages in thread
From: Pavel Koshevoy @ 2025-08-07 12:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Ping


On Mon, Aug 4, 2025, 13:50 Pavel Koshevoy <pkoshevoy@gmail.com> wrote:

> ---
>  libavcodec/mfenc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
> index 30531fe3e8..942c75cb9d 100644
> --- a/libavcodec/mfenc.c
> +++ b/libavcodec/mfenc.c
> @@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext
> *avctx, IMFSample *sample)
>      return mf_from_mf_time(avctx, pts);
>  }
>
> +static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample
> *sample)
> +{
> +    LONGLONG duration;
> +    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
> +    if (FAILED(hr))
> +        return 0;
> +    return mf_from_mf_time(avctx, duration);
> +}
> +
>  static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType
> *type)
>  {
>      MFContext *c = avctx->priv_data;
> @@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext
> *avctx, IMFSample *sample, AVPac
>      IMFMediaBuffer_Release(buffer);
>
>      avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
> +    avpkt->duration = mf_sample_get_duration(avctx, sample);
>
>      hr = IMFAttributes_GetUINT32(sample, &MFSampleExtension_CleanPoint,
> &t32);
>      if (c->is_audio || (!FAILED(hr) && t32 != 0))
> --
> 2.43.0
>
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
  2025-08-04 19:50 [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration Pavel Koshevoy
  2025-08-07 12:14 ` Pavel Koshevoy
@ 2025-08-12 13:56 ` Pavel Koshevoy
  2025-08-12 13:58 ` James Almer
  2 siblings, 0 replies; 6+ messages in thread
From: Pavel Koshevoy @ 2025-08-12 13:56 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

2nd ping.  This is a trivial fix, can someone approve this please.

Thank you,
    Pavel


On Mon, Aug 4, 2025, 13:50 Pavel Koshevoy <pkoshevoy@gmail.com> wrote:

> ---
>  libavcodec/mfenc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
> index 30531fe3e8..942c75cb9d 100644
> --- a/libavcodec/mfenc.c
> +++ b/libavcodec/mfenc.c
> @@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext
> *avctx, IMFSample *sample)
>      return mf_from_mf_time(avctx, pts);
>  }
>
> +static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample
> *sample)
> +{
> +    LONGLONG duration;
> +    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
> +    if (FAILED(hr))
> +        return 0;
> +    return mf_from_mf_time(avctx, duration);
> +}
> +
>  static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType
> *type)
>  {
>      MFContext *c = avctx->priv_data;
> @@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext
> *avctx, IMFSample *sample, AVPac
>      IMFMediaBuffer_Release(buffer);
>
>      avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
> +    avpkt->duration = mf_sample_get_duration(avctx, sample);
>
>      hr = IMFAttributes_GetUINT32(sample, &MFSampleExtension_CleanPoint,
> &t32);
>      if (c->is_audio || (!FAILED(hr) && t32 != 0))
> --
> 2.43.0
>
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
  2025-08-04 19:50 [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration Pavel Koshevoy
  2025-08-07 12:14 ` Pavel Koshevoy
  2025-08-12 13:56 ` Pavel Koshevoy
@ 2025-08-12 13:58 ` James Almer
  2025-08-13 23:39   ` Pavel Koshevoy
  2 siblings, 1 reply; 6+ messages in thread
From: James Almer @ 2025-08-12 13:58 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1312 bytes --]

On 8/4/2025 4:50 PM, Pavel Koshevoy wrote:
> ---
>   libavcodec/mfenc.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
> index 30531fe3e8..942c75cb9d 100644
> --- a/libavcodec/mfenc.c
> +++ b/libavcodec/mfenc.c
> @@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext *avctx, IMFSample *sample)
>       return mf_from_mf_time(avctx, pts);
>   }
>   
> +static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample *sample)
> +{
> +    LONGLONG duration;
> +    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
> +    if (FAILED(hr))
> +        return 0;
> +    return mf_from_mf_time(avctx, duration);
> +}
> +
>   static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType *type)
>   {
>       MFContext *c = avctx->priv_data;
> @@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext *avctx, IMFSample *sample, AVPac
>       IMFMediaBuffer_Release(buffer);
>   
>       avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
> +    avpkt->duration = mf_sample_get_duration(avctx, sample);
>   
>       hr = IMFAttributes_GetUINT32(sample, &MFSampleExtension_CleanPoint, &t32);
>       if (c->is_audio || (!FAILED(hr) && t32 != 0))

Will apply.


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
  2025-08-12 13:58 ` James Almer
@ 2025-08-13 23:39   ` Pavel Koshevoy
  2025-08-14 14:14     ` James Almer via ffmpeg-devel
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Koshevoy @ 2025-08-13 23:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Aug 12, 2025 at 7:59 AM James Almer <jamrial@gmail.com> wrote:

> On 8/4/2025 4:50 PM, Pavel Koshevoy wrote:
> > ---
> >   libavcodec/mfenc.c | 10 ++++++++++
> >   1 file changed, 10 insertions(+)
> >
> > diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
> > index 30531fe3e8..942c75cb9d 100644
> > --- a/libavcodec/mfenc.c
> > +++ b/libavcodec/mfenc.c
> > @@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext
> *avctx, IMFSample *sample)
> >       return mf_from_mf_time(avctx, pts);
> >   }
> >
> > +static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample
> *sample)
> > +{
> > +    LONGLONG duration;
> > +    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
> > +    if (FAILED(hr))
> > +        return 0;
> > +    return mf_from_mf_time(avctx, duration);
> > +}
> > +
> >   static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType
> *type)
> >   {
> >       MFContext *c = avctx->priv_data;
> > @@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext
> *avctx, IMFSample *sample, AVPac
> >       IMFMediaBuffer_Release(buffer);
> >
> >       avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
> > +    avpkt->duration = mf_sample_get_duration(avctx, sample);
> >
> >       hr = IMFAttributes_GetUINT32(sample,
> &MFSampleExtension_CleanPoint, &t32);
> >       if (c->is_audio || (!FAILED(hr) && t32 != 0))
>
> Will apply.
>


I just checked, and it's not applied.  Any idea when it will be applied?

Thank you,
    Pavel.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration
  2025-08-13 23:39   ` Pavel Koshevoy
@ 2025-08-14 14:14     ` James Almer via ffmpeg-devel
  0 siblings, 0 replies; 6+ messages in thread
From: James Almer via ffmpeg-devel @ 2025-08-14 14:14 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: James Almer


[-- Attachment #1.1.1: Type: text/plain, Size: 1637 bytes --]

On 8/13/2025 8:39 PM, Pavel Koshevoy wrote:
> On Tue, Aug 12, 2025 at 7:59 AM James Almer <jamrial@gmail.com> wrote:
> 
>> On 8/4/2025 4:50 PM, Pavel Koshevoy wrote:
>>> ---
>>>    libavcodec/mfenc.c | 10 ++++++++++
>>>    1 file changed, 10 insertions(+)
>>>
>>> diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
>>> index 30531fe3e8..942c75cb9d 100644
>>> --- a/libavcodec/mfenc.c
>>> +++ b/libavcodec/mfenc.c
>>> @@ -148,6 +148,15 @@ static int64_t mf_sample_get_pts(AVCodecContext
>> *avctx, IMFSample *sample)
>>>        return mf_from_mf_time(avctx, pts);
>>>    }
>>>
>>> +static int64_t mf_sample_get_duration(AVCodecContext *avctx, IMFSample
>> *sample)
>>> +{
>>> +    LONGLONG duration;
>>> +    HRESULT hr = IMFSample_GetSampleDuration(sample, &duration);
>>> +    if (FAILED(hr))
>>> +        return 0;
>>> +    return mf_from_mf_time(avctx, duration);
>>> +}
>>> +
>>>    static int mf_enca_output_type_get(AVCodecContext *avctx, IMFMediaType
>> *type)
>>>    {
>>>        MFContext *c = avctx->priv_data;
>>> @@ -275,6 +284,7 @@ static int mf_sample_to_avpacket(AVCodecContext
>> *avctx, IMFSample *sample, AVPac
>>>        IMFMediaBuffer_Release(buffer);
>>>
>>>        avpkt->pts = avpkt->dts = mf_sample_get_pts(avctx, sample);
>>> +    avpkt->duration = mf_sample_get_duration(avctx, sample);
>>>
>>>        hr = IMFAttributes_GetUINT32(sample,
>> &MFSampleExtension_CleanPoint, &t32);
>>>        if (c->is_audio || (!FAILED(hr) && t32 != 0))
>>
>> Will apply.
>>
> 
> 
> I just checked, and it's not applied.  Any idea when it will be applied?

Just pushed it.


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-14 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-04 19:50 [FFmpeg-devel] [PATCH] lavc/mfenc: set output packet duration Pavel Koshevoy
2025-08-07 12:14 ` Pavel Koshevoy
2025-08-12 13:56 ` Pavel Koshevoy
2025-08-12 13:58 ` James Almer
2025-08-13 23:39   ` Pavel Koshevoy
2025-08-14 14:14     ` James Almer via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git