[FFmpeg-devel] [PATCH 1/3] lavf: add video device callbacks

Lukasz M lukasz.m.luki at gmail.com
Mon Jan 13 23:29:40 CET 2014


On 13 January 2014 23:07, Marton Balint <cus at passwd.hu> wrote:

>
> On Mon, 13 Jan 2014, Lukasz Marek wrote:
>
>  Adds 2 callbacks to AVFormatContext
>> - window_size_cb
>>    allows device to read user provided window dimensions
>> - window_swap_buffers_cb
>>    allows device to swap buffers of user provided window
>>
>> Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
>> ---
>> libavformat/avformat.h | 33 +++++++++++++++++++++++++++++++++
>> libavformat/utils.c    |  3 +++
>> libavformat/version.h  |  2 +-
>> 3 files changed, 37 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index 6d719d7..6fb9fdd 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -948,6 +948,17 @@ typedef struct AVChapter {
>>
>>
>> /**
>> + * Callback used by video output devices to get user provided window
>> dimensions.
>> + */
>> +typedef int (*av_format_device_window_size_callback)(struct
>> AVFormatContext *, int *, int *);
>> +
>>
>
> Isn't that actually the area used for drawing in the window? If it really
> is, than I'd rather call it av_format_device_get_draw_area_callback or
> something like that.
>
> Also probably it would be more generic to also query a top and a left
> offset in the window.


No, it is size of whole window. Drawing arena in calculated inside device
based on window and frame size.
I will remove it anyway and follow Nicolas' control_message API.


>  +/**
>> + * Callback used by video output devices to swap buffers of user
>> provided window.
>> + */
>> +typedef int (*av_format_device_window_swap_buffers_callback)(struct
>> AVFormatContext *);
>> +
>> +
>> +/**
>>  * The duration of a video can be estimated through various ways, and
>> this enum can be used
>>  * to know how the duration was estimated.
>>  */
>> @@ -1348,6 +1359,22 @@ typedef struct AVFormatContext {
>>      * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct
>> access).
>>      */
>>     AVCodec *subtitle_codec;
>> +
>> +    /**
>> +     * User data.
>> +     */
>> +    void *user_data;
>>
>
> I beleive all over the codebase this is called "opaque" instead.


Right, I will change it in new version.


More information about the ffmpeg-devel mailing list