[FFmpeg-devel] [RFC] AVSubtitles rework
nicolas.george at normalesup.org
Sun Sep 2 21:31:01 CEST 2012
Le septidi 17 fructidor, an CCXX, Clément Bœsch a écrit :
> After speaking a little with Nicolas & Alexander yesterday, it appeared
> that introducing avcodec_get_subtitle_defaults()/avcodec_alloc_subtitle()
> to avoid ABI problems with sizeof(AVSubtitle) would be the first step in
> improving the current subtitles situation.
I wonder if it is necessary to make it a new structure. That would force
people to realize that something has changed, and allow to add new fields at
the end without touching the original structure.
If we decide for a new structure, I suggest to have the first field "int
struct_size", set to sizeof(struct) by the alloc function. That makes an
easy and reliable consistency test.
> Do we want to move the AVSubtitleRect from AVSubtitles to the codec
> context (and keep a pointer in the AVSubtitleRect)?
Unless I am mistaken, the only reason to have the frame data belong to the
codec context rather than the frame is to allow references frames and direct
rendering using the get_buffer/release_buffer logic. I do not think we need
that kind of logic for subtitles, but I may be wrong.
> This would allow the
> to use av_free() on the AVSubtitles instead of the current
> avsubtitle_free(), just like it's done for frames.
Actually, I think the "you must free the structure but not the data it
points to" API is rather confusing for users, and a "you must free
everything, there is a convenience function to do it" API would be less
> Also, adding the AVSubtitle allocation will cause problem for the
> -fix_sub_duration option recently added in ffmpeg (0cad101e) since we
> can't swap the AVSubtitle anymore. The AVSubtitle will be allocated only
> once (just like decoded_frame, we would introduce a decoded_subtitle in
> the input stream), a pointer copy won't work AFAICT. The question is then,
> how do we want to support such subtitles copy props? The only similar
> thing I see for the equivalent AVFrame is the copy props in lavfi. Any
I do not see why it would not be possible to allocate two structures and
simply swap the pointers to them. Maybe I am missing something?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel