[vlc-devel] [PATCH 02/23] macosx: helpers: add getVouts

Marvin Scholz epirat07 at gmail.com
Thu Jun 29 14:46:20 CEST 2017


Thanks for your patches.

On 29 Jun 2017, at 14:24, Victorien Le Couviour--Tuffet wrote:

> ---
>  modules/gui/macosx/helpers.h | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/modules/gui/macosx/helpers.h 
> b/modules/gui/macosx/helpers.h
> index fefd0e6c19..cbbf2c19a3 100644
> --- a/modules/gui/macosx/helpers.h
> +++ b/modules/gui/macosx/helpers.h
> @@ -44,6 +44,31 @@ static inline vout_thread_t *getVout(void)
>      return p_vout;
>  }
>

It would be awesome if you could add a doxygen-style comment.

> +static inline NSArray<NSValue *> *getVouts(void)

I don't think we can use type annotated arrays yet, given that VLC still 
needs to build with
old Xcode versions, for now.

> +{
> +    input_thread_t *p_input = getInput();
> +    vout_thread_t **pp_vouts;
> +    size_t i_num_vouts;
> +
> +    if (!p_input
> +        || input_Control(p_input, INPUT_GET_VOUTS, &pp_vouts, 
> &i_num_vouts)
> +        || !i_num_vouts)
> +        return [NSArray array];

Wouldn't it make more sense to return nil here?

> +
> +    NSMutableArray<NSValue *> *vouts =
> +        [NSMutableArray arrayWithCapacity : i_num_vouts];

Minor codestyle thing: I prefer to not put a space before and after the 
":", this
is a very uncommon thing to do in Objective C.

NSMutableArray<NSValue *> *vouts = [NSMutableArray 
arrayWithCapacity:i_num_vouts];

> +
> +    for (size_t i = 0; i < i_num_vouts; ++i)
> +    {
> +        assert(pp_vouts[i]);
> +        [vouts insertObject : [NSValue valueWithPointer : 
> pp_vouts[i]] // try addObject

What does the "try addObject" comment means?

> +                    atIndex : i];
> +    }
> +
> +    free(pp_vouts);
> +    return vouts;
> +}
> +
>  static inline vout_thread_t *getVoutForActiveWindow(void)
>  {
>      vout_thread_t *p_vout = nil;
> -- 
> 2.13.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list