[FFmpeg-devel] [PATCH] lavd/avdevice: add control message enums

Nicolas George george at nsup.org
Thu Apr 10 23:48:17 CEST 2014


Le primidi 21 germinal, an CCXXII, Lukasz Marek a écrit :
> >From 8b003ade41a27856230c77d2883c6efa7e75916b Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Thu, 10 Apr 2014 00:47:32 +0200
> Subject: [PATCH] lavd: add control message enums
> 
> ---
>  libavdevice/avdevice.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 47 insertions(+), 2 deletions(-)
> 
> diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
> index e194663..7db718f 100644
> --- a/libavdevice/avdevice.h
> +++ b/libavdevice/avdevice.h
> @@ -112,6 +112,14 @@ typedef struct AVDeviceRect {
>      int height; /**< height */
>  } AVDeviceRect;
>  

> +typedef union AVDeviceValue {
> +    uint64_t u64;
> +    int64_t i64;
> +    double dbl;
> +    const char *str;
> +    AVRational q;
> +} AVDeviceValue;

Can you explain the point of this union? As far as I can see, you could just
as easily document the exact type for data.

> +
>  /**
>   * Message types used by avdevice_app_to_dev_control_message().
>   */
> @@ -140,7 +148,20 @@ enum AVAppToDevMessageType {
>       * data: AVDeviceRect: area required to be repainted.
>       *       NULL: whole area is required to be repainted.
>       */

> -    AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A')
> +    AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A'),
> +
> +    /**
> +     * Request pause/play.
> +     *
> +     * Application requests pause/unpause playback.
> +     * Mostly usable with devices that have internal buffer.
> +     * By default devices are not paused.
> +     *
> +     * data: NULL
> +     */
> +    AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '),
> +    AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'),
> +    AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T')

Add a final coma, that will avoid spurious changes like the first line of
this hunk for the next time.

Alignment could be nice too.

>  };
>  
>  /**
> @@ -199,7 +220,31 @@ enum AVDevToAppMessageType {
>       *
>       * data: NULL.
>       */
> -    AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B','D','E','S')
> +    AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B','D','E','S'),
> +
> +    /**
> +     * Buffer fullness status messages.
> +     *
> +     * Device signals buffer overflow/underflow.
> +     *
> +     * data: NULL.
> +     */
> +    AV_DEV_TO_APP_BUFFER_OVERFLOW = MKBETAG('B','O','F','L'),
> +    AV_DEV_TO_APP_BUFFER_UNDERFLOW = MKBETAG('B','U','F','L'),
> +
> +    /**
> +     * Buffer readable/writable.
> +     *
> +     * Device informs that buffer is readable/writable.
> +     * When possible, device informs how many bytes can be read/write.
> +     *
> +     * @warning Device may not inform when number of bytes than can be read/write changes.
> +     *
> +     * data: AVDeviceValue(int64_t): amount of bytes available to read/write.
> +     *       NULL: amount of bytes available to read/write is not known.
> +     */
> +    AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B','R','D',' '),
> +    AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B','W','R',' ')

Ditto.

>  };
>  
>  /**

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140410/e5334f5a/attachment.asc>


More information about the ffmpeg-devel mailing list