[Matroska-devel] haali and vorbis

Drpark drpark at wanadoo.fr
Mon Jul 31 19:35:50 CEST 2006


Thansk for your answer,
can you show me the way to skip the encoded lengh byte and retrieve the 
3 needed header sizes?

Thanks in advance,

Mike Matsnev a écrit :
> On Sun, Jul 30, 2006 at 04:43:07PM +0200, Attractionland - Jeremy Cardon wrote:
>   
>> Hello everybody,
>> I'm new to the list,
>>
>> I'm trying as an exercise to retrieve mp3 and vorbis datas from a mkv file,
>> for the mp3 everything is working ok, but for vorbis
>> I don't really know how to get the three vorbis headers sizes easily
>>
>> here is my code, I don't have any problem at compile time, but my graph 
>> can't connect,
>> this code is inspired from the matroska directshow filter,
>>
>> this is part of the GetMediaType method
>>
>> BYTE *codecPrivate = (unsigned char*)trackinf->CodecPrivate;
>> VORBISFORMAT2* pvf2 = 
>> (VORBISFORMAT2*)m_mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + 
>> tinf->CodecPrivateSize - 3);
>>           memcpy((BYTE *)pvf2+sizeof(VORBISFORMAT2),codecPrivate+3, 
>> trackinf->CodecPrivateSize-3);
>>     
> This is wrong. You need to skip the encoded length bytes, their number is
> variable and usually more than 3.
>   
>>           unsigned int lastHeaderSize = trackinf->CodecPrivateSize-1;
>>           unsigned int nbHeaders = 2;//*((unsigned int *)codecPrivate);
>>           codecPrivate++;                      // 3 headers for vorbis
>>               FILE* f;
>>           f=fopen("salutaudio.txt","w");
>>           fprintf(f,"salut %i",nbHeaders);
>>           fclose(f);
>>           while(nbHeaders)
>>           {
>>               unsigned int currentHeaderSize = 0;
>>               do{
>>                   currentHeaderSize += *(unsigned int *)codecPrivate;
>>                   lastHeaderSize--;
>>               } while((*codecPrivate++) == 0xFF);
>>               lastHeaderSize -= currentHeaderSize;
>>               pvf2->HeaderSize[2-nbHeaders] = currentHeaderSize;
>>               nbHeaders--;
>>           }                        //pvf2->HeaderSize[0] = 
>> trackinf->CodecPrivate;
>>           //pvf2->HeaderSize[1] = trackinf->CodecPrivate;
>>           //pvf2->HeaderSize[2] = trackinf->CodecPrivateSize-1;
>>           pvf2->HeaderSize[2-nbHeaders] = lastHeaderSize;
>>           pvf2->Channels = trackinf->AV.Audio.Channels;
>>           pvf2->SamplesPerSec = trackinf->AV.Audio.SamplingFreq;
>>           pvf2->BitsPerSample = trackinf->AV.Audio.BitDepth;           
>>           m_mt.SetSampleSize(1);
>>
>> Many thanks for your help
>>
>> _______________________________________________
>> Matroska-devel mailing list
>> Matroska-devel at lists.matroska.org
>> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel
>> Read Matroska-Devel on GMane: 
>> http://dir.gmane.org/gmane.comp.multimedia.matroska.devel
>>
>>     
> _______________________________________________
> Matroska-devel mailing list
> Matroska-devel at lists.matroska.org
> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel
> Read Matroska-Devel on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.devel
> ---------------------------------------------------------------------------------------
> Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
> Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>
>   




More information about the Matroska-devel mailing list