[FFmpeg-devel] Touching base on first decoder ( CDXL ) before loosing direction
Reimar Döffinger
Reimar.Doeffinger
Wed Apr 8 14:58:29 CEST 2009
On Tue, Apr 07, 2009 at 02:30:00PM -0500, Erion Omeri wrote:
> typedef int* p_PicListEntry;
> typedef int* PArr8[8];
> typedef long TagArr[10];
> typedef long LArr16[16];
Generally we tend to avoid typedefs, and we certainly don't do the p_...
naming.
Also a .h file is pointless if its contents are used only in one file,
move them to the .c file
> typedef struct XLHeader{
> char CDXLType;
> char Info;
> long CurrSize;
> int PrevSize;
> int resl;
> int CurrFrameNum;
> int Width;
> int Height;
> int Depth;
> int CMapSize;
> int RawSoundSize;
> long res2;
> long res3;
> };
>
> typedef struct PicListEntry{
> PicListEntry* NextEntry;
> char Flags;
> long FrameNum;
> long MSecs;
> long PMemA;
> long PMemL;
> long CMemA;
> long CMemL;
> };
>
> typedef struct SndListEntry{
> SndListEntry* NextSndEntry;
> long FrameNum;
> long SMemA,SMemL;
> };
Huh, the "typedef" part makes no sense, you are not defining
any types (you do not need typedefs to define "struct something").
You also have a few tabs there.
> LArr16* DataAddr;
> IntuitionBase* IBase;
> rtFileRequester* MyFReq;
> SndListEntry* LoadSEntry, MySEntry, LastSEntry;
> PicListEntry* LoadDEntry,MyDEntry,LastDEntry;
>
> SndListEntry FirstSEntry;
> PicListEntry FirstDEntry;
> BPTR FHandle; //Bit pointer??
> TagArr Tags;
> NewScreen NeuScreen;
> Screen* MyScreen[2];
>
>
> int PlaySound[0], ColorUsed, j, ColCnt, YOffset, SoundModeOffset, SoundModeLength,
> LoopNum, ErrorFlag, HeadFlag, FirstFrame, JumpAllowed;
>
> long i, l, ChunkLength, Frames, SpaceMem, CMAPPos, ChunkPos, ChunkMemA, PlayFrame,
> StartSec, EndSec, StartMSec, EndMSec, LineSize, BodyAddr, DeltaMemA, DeltaMemL,
> ScrMode, InEffectiveFrames, SoundMemA[2], SoundMemL[2];
>
> char AScr, PathFR[100], FileName[100], ChunkName[5];
> char* f, LData, s;
Any data that is specific to a decoded file must be in the decoder
context, it may not be global data.
Anything that remains must be either "static" to be file-local or
it must have a ff_ or av_ prefix.
> FreeMem(IMemA, BitMapSize);
Huh? FreeMem is not a C function, and in FFmpeg the memory management
functions are av_malloc, av_mallocz, av_free, av_freep
> printf(f, s);
printf is not allowed and will not compile.
av_log could be used.
> l = DosRead(FHandle, XHLD, sizeof(XLHeader);
Well, obviously this is copied from some Windows source, you need
to use the corresponding libavformat functions.
Also you can not read directly into a struct, a struct will look
completely different in-memory depending on compiler and architecture
(in particular big-endian systems).
> static int cdxl_decode_frame(
> AVCodecContext * avctx,
> void *data,
> int *data_size,
> const uint8_t * buf,
> int buf_size ) {
Also you need two files anyway:
one in libavformat/ that reads and splits the file into audio and video parts and
one in libavcodec/ that decodes the video (at least to support the
HAM-encoded video, the PCM-encoded audio and paletted video formats
should already be supported).
More information about the ffmpeg-devel
mailing list