* [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
@ 2023-05-02 7:48 Zhao Zhili
2023-05-02 8:32 ` Paul B Mahol
2023-05-02 11:34 ` Tomas Härdin
0 siblings, 2 replies; 7+ messages in thread
From: Zhao Zhili @ 2023-05-02 7:48 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
libavutil/opt.h | 2 ++
libavutil/version.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 461b5d3b6b..46915754ea 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -271,8 +271,10 @@ typedef struct AVOption {
int64_t i64;
double dbl;
const char *str;
+#if FF_API_AVOPTION_AVRATIONAL
/* TODO those are unused now */
AVRational q;
+#endif
} default_val;
double min; ///< minimum valid value for the option
double max; ///< maximum valid value for the option
diff --git a/libavutil/version.h b/libavutil/version.h
index 40f92af055..56af5c09c4 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -115,6 +115,7 @@
#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_AVOPTION_AVRATIONAL (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}
--
2.40.1
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 7:48 [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val Zhao Zhili
@ 2023-05-02 8:32 ` Paul B Mahol
2023-05-02 11:34 ` Tomas Härdin
1 sibling, 0 replies; 7+ messages in thread
From: Paul B Mahol @ 2023-05-02 8:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
NAK
It can be made useful.
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 7:48 [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val Zhao Zhili
2023-05-02 8:32 ` Paul B Mahol
@ 2023-05-02 11:34 ` Tomas Härdin
2023-05-02 11:39 ` James Almer
1 sibling, 1 reply; 7+ messages in thread
From: Tomas Härdin @ 2023-05-02 11:34 UTC (permalink / raw)
To: FFmpeg development discussions and patches
tis 2023-05-02 klockan 15:48 +0800 skrev Zhao Zhili:
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
> libavutil/opt.h | 2 ++
> libavutil/version.h | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/libavutil/opt.h b/libavutil/opt.h
> index 461b5d3b6b..46915754ea 100644
> --- a/libavutil/opt.h
> +++ b/libavutil/opt.h
> @@ -271,8 +271,10 @@ typedef struct AVOption {
> int64_t i64;
> double dbl;
> const char *str;
> +#if FF_API_AVOPTION_AVRATIONAL
> /* TODO those are unused now */
> AVRational q;
> +#endif
Surely rationals options are useful?
/Tomas
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 11:34 ` Tomas Härdin
@ 2023-05-02 11:39 ` James Almer
2023-05-02 11:51 ` Paul B Mahol
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: James Almer @ 2023-05-02 11:39 UTC (permalink / raw)
To: ffmpeg-devel
On 5/2/2023 8:34 AM, Tomas Härdin wrote:
> tis 2023-05-02 klockan 15:48 +0800 skrev Zhao Zhili:
>> From: Zhao Zhili <zhilizhao@tencent.com>
>>
>> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
>> ---
>> libavutil/opt.h | 2 ++
>> libavutil/version.h | 1 +
>> 2 files changed, 3 insertions(+)
>>
>> diff --git a/libavutil/opt.h b/libavutil/opt.h
>> index 461b5d3b6b..46915754ea 100644
>> --- a/libavutil/opt.h
>> +++ b/libavutil/opt.h
>> @@ -271,8 +271,10 @@ typedef struct AVOption {
>> int64_t i64;
>> double dbl;
>> const char *str;
>> +#if FF_API_AVOPTION_AVRATIONAL
>> /* TODO those are unused now */
>> AVRational q;
>> +#endif
>
> Surely rationals options are useful?
They are, but this union is where the default value is stored when you
define an AVOption. At some point it seems it was decided that rational
(and video_rate) type AVOptions should set dbl instead of q, which is
then av_q2d()'d into an AVRational.
I'd still not remove it, as Paul said. It's harmless being there and in
the future it could be used.
>
> /Tomas
>
> _______________________________________________
> 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".
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 11:39 ` James Almer
@ 2023-05-02 11:51 ` Paul B Mahol
2023-05-03 3:08 ` Zhao Zhili
2023-05-09 10:02 ` Tomas Härdin
2 siblings, 0 replies; 7+ messages in thread
From: Paul B Mahol @ 2023-05-02 11:51 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, May 2, 2023 at 1:40 PM James Almer <jamrial@gmail.com> wrote:
> On 5/2/2023 8:34 AM, Tomas Härdin wrote:
> > tis 2023-05-02 klockan 15:48 +0800 skrev Zhao Zhili:
> >> From: Zhao Zhili <zhilizhao@tencent.com>
> >>
> >> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> >> ---
> >> libavutil/opt.h | 2 ++
> >> libavutil/version.h | 1 +
> >> 2 files changed, 3 insertions(+)
> >>
> >> diff --git a/libavutil/opt.h b/libavutil/opt.h
> >> index 461b5d3b6b..46915754ea 100644
> >> --- a/libavutil/opt.h
> >> +++ b/libavutil/opt.h
> >> @@ -271,8 +271,10 @@ typedef struct AVOption {
> >> int64_t i64;
> >> double dbl;
> >> const char *str;
> >> +#if FF_API_AVOPTION_AVRATIONAL
> >> /* TODO those are unused now */
> >> AVRational q;
> >> +#endif
> >
> > Surely rationals options are useful?
>
> They are, but this union is where the default value is stored when you
> define an AVOption. At some point it seems it was decided that rational
> (and video_rate) type AVOptions should set dbl instead of q, which is
> then av_q2d()'d into an AVRational.
>
> I'd still not remove it, as Paul said. It's harmless being there and in
> the future it could be used.
>
Yes, I think that using double for AVRational is not always correct/precise.
Do anyone remember why it is double?
I can send patch to fix this. But I dunno if that may break API and/or ABI.
>
> >
> > /Tomas
> >
> > _______________________________________________
> > 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".
> _______________________________________________
> 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".
>
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 11:39 ` James Almer
2023-05-02 11:51 ` Paul B Mahol
@ 2023-05-03 3:08 ` Zhao Zhili
2023-05-09 10:02 ` Tomas Härdin
2 siblings, 0 replies; 7+ messages in thread
From: Zhao Zhili @ 2023-05-03 3:08 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> 在 2023年5月2日,19:39,James Almer <jamrial@gmail.com> 写道:
>
> On 5/2/2023 8:34 AM, Tomas Härdin wrote:
>> tis 2023-05-02 klockan 15:48 +0800 skrev Zhao Zhili:
>>> From: Zhao Zhili <zhilizhao@tencent.com>
>>>
>>> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
>>> ---
>>> libavutil/opt.h | 2 ++
>>> libavutil/version.h | 1 +
>>> 2 files changed, 3 insertions(+)
>>>
>>> diff --git a/libavutil/opt.h b/libavutil/opt.h
>>> index 461b5d3b6b..46915754ea 100644
>>> --- a/libavutil/opt.h
>>> +++ b/libavutil/opt.h
>>> @@ -271,8 +271,10 @@ typedef struct AVOption {
>>> int64_t i64;
>>> double dbl;
>>> const char *str;
>>> +#if FF_API_AVOPTION_AVRATIONAL
>>> /* TODO those are unused now */
>>> AVRational q;
>>> +#endif
>> Surely rationals options are useful?
>
> They are, but this union is where the default value is stored when you define an AVOption. At some point it seems it was decided that rational (and video_rate) type AVOptions should set dbl instead of q, which is then av_q2d()'d into an AVRational.
>
> I'd still not remove it, as Paul said. It's harmless being there and in the future it could be used.
The field itself is harmless, but it makes big confusing. It takes me some efforts to figure out a rational type must use dbl to hold default value.
For backward compatibility, I don’t think it’s easy to switch to AVRational from dbl.
If we decide to keep it, I can add a comment to reduce the confusion.
>
>> /Tomas
>> _______________________________________________
>> 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".
> _______________________________________________
> 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 sub
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val
2023-05-02 11:39 ` James Almer
2023-05-02 11:51 ` Paul B Mahol
2023-05-03 3:08 ` Zhao Zhili
@ 2023-05-09 10:02 ` Tomas Härdin
2 siblings, 0 replies; 7+ messages in thread
From: Tomas Härdin @ 2023-05-09 10:02 UTC (permalink / raw)
To: FFmpeg development discussions and patches
tis 2023-05-02 klockan 08:39 -0300 skrev James Almer:
> On 5/2/2023 8:34 AM, Tomas Härdin wrote:
> > tis 2023-05-02 klockan 15:48 +0800 skrev Zhao Zhili:
> > > From: Zhao Zhili <zhilizhao@tencent.com>
> > >
> > > Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> > > ---
> > > libavutil/opt.h | 2 ++
> > > libavutil/version.h | 1 +
> > > 2 files changed, 3 insertions(+)
> > >
> > > diff --git a/libavutil/opt.h b/libavutil/opt.h
> > > index 461b5d3b6b..46915754ea 100644
> > > --- a/libavutil/opt.h
> > > +++ b/libavutil/opt.h
> > > @@ -271,8 +271,10 @@ typedef struct AVOption {
> > > int64_t i64;
> > > double dbl;
> > > const char *str;
> > > +#if FF_API_AVOPTION_AVRATIONAL
> > > /* TODO those are unused now */
> > > AVRational q;
> > > +#endif
> >
> > Surely rationals options are useful?
>
> They are, but this union is where the default value is stored when
> you
> define an AVOption. At some point it seems it was decided that
> rational
> (and video_rate) type AVOptions should set dbl instead of q, which is
> then av_q2d()'d into an AVRational.
Cursed and very wrong in many contexts
/Tomas
_______________________________________________
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] 7+ messages in thread
end of thread, other threads:[~2023-05-09 10:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 7:48 [FFmpeg-devel] [PATCH v2] avutil: deprecate AVRational field inside AVOption::default_val Zhao Zhili
2023-05-02 8:32 ` Paul B Mahol
2023-05-02 11:34 ` Tomas Härdin
2023-05-02 11:39 ` James Almer
2023-05-02 11:51 ` Paul B Mahol
2023-05-03 3:08 ` Zhao Zhili
2023-05-09 10:02 ` Tomas Härdin
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