[FFmpeg-devel] [PATCH] mxf umid generation
Baptiste Coudurier
baptiste.coudurier
Sun Mar 8 01:14:19 CET 2009
On 3/7/2009 3:36 PM, Michael Niedermayer wrote:
> On Sat, Mar 07, 2009 at 02:48:49PM -0800, Baptiste Coudurier wrote:
>> On 3/6/2009 7:44 PM, Michael Niedermayer wrote:
>>> On Fri, Mar 06, 2009 at 07:28:55PM -0800, Baptiste Coudurier wrote:
>>>> Hi,
>>>>
>>>> It seems some products really check umid and base themself on its
>>>> uniqueness, so it seems better to actually try to generate a unique number.
>>>>
>>>> Is the approach in the patch acceptable ? If no,
>>>
>>>
>>>> any other suggestion ?
>>> yes, add a random_seed.c/h
>>> that does:
>>> 1. try to get a uint32 from reading /dev/(u)random
>>> 2. try to get a uint32 from LSB of rdtsc (and similar for ppc/bfin see
>>> libavutil/timer.h)
>>> 3. md5 or sha1 of the first frame or extradata
>>>
>> Like this ?
>>
>
> [...]
>
>> +/*
>> + * Get a seed to use in conjuction with random functions
>> + */
>
> missing /**
> and should be in the header
>
Done.
>> +uint32_t ff_random_get_seed(void)
>> +{
>> + uint32_t seed;
>> + int fd;
>> +
>
>> + if ((fd = open("/dev/random", O_RDONLY)) != -1) {
>> + read(fd, &seed, 4);
>> + close(fd);
>> + return seed;
>> + }
>> + if ((fd = open("/dev/urandom", O_RDONLY)) != -1) {
>> + read(fd, &seed, 4);
>> + close(fd);
>> + return seed;
>> + }
>
> if((fd = open("/dev/random", O_RDONLY)) == -1)
> fd = open("/dev/urandom", O_RDONLY);
> if(fd != -1){
> read(fd, &seed, 4);
> close(fd);
> return seed;
> }
Changed.
>
>> Property changes on: libavutil\random_seed.c
>> ___________________________________________________________________
>> Added: svn:eol-style
>> + LF
>
> intended?
>
> except these ok
>
I'm not sure, I'm on windows because products I test with only works on
windows, I set ending lines style to unix, but it keeps adding this...
It should be ok I think.
Btw, is lfg ok for this purpose or should I use something else ?
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer http://www.ffmpeg.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: random_seed2.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090307/b340c851/attachment.asc>
More information about the ffmpeg-devel
mailing list