[vlc-devel] [vlc-commits] Implement libvlc_video_get_size(), close #3679

Rafaël Carré funman at videolan.org
Mon Jan 16 00:32:57 CET 2012


Le 2012-01-15 16:32, Rémi Denis-Courmont a écrit :
>    Hello,

Hi,

> On Sunday 15 January 2012, Rafaël Carré wrote:
>> vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Jan 15
>> 15:50:05 2012 -0500| [8cf355785e002ade33af056c68123b395ff4e46f] |
>> committer: Rafaël Carré
>>
>> Implement libvlc_video_get_size(), close #3679
>>
>>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cf355785e002ade33
>>> af056c68123b395ff4e46f
>>
>> ---
>>
>>  lib/video.c |   26 +++++++++++++++-----------
>>  1 files changed, 15 insertions(+), 11 deletions(-)
>>
>> diff --git a/lib/video.c b/lib/video.c
>> index 163bca3..7e092bd 100644
>> --- a/lib/video.c
>> +++ b/lib/video.c
>> @@ -161,18 +161,22 @@ libvlc_video_take_snapshot( libvlc_media_player_t
>> *p_mi, unsigned num, int libvlc_video_get_size( libvlc_media_player_t
>> *p_mi, unsigned num, unsigned *restrict px, unsigned *restrict py ) {
>> -#if 0
>> -    vout_thread_t *p_vout = GetVout (p_mi, num);
>> -    if (p_vout == NULL)
>> -        return -1;
>> +    libvlc_media_track_info_t *info;
>> +    int ret = -1;
>> +    int infos = libvlc_media_get_tracks_info(p_mi->p_md, &info);
> 
> Can't you reflect a bit on the code you're writing?

I can

> What if p_md is NULL? 

I guess it's a crash?

> Sorry, but you cannot claim that it is hard to think
> about a pointer (not) being NULL! And oh, libvlc_media_get_tracks_info, first 
> line, is an assert() about this exact problem.

Never made such a claim?



More information about the vlc-devel mailing list