Mercurial > libavcodec.hg
comparison avcodec.c @ 852:c01c98206ee6 libavcodec
* useless commit - ignore
| author | kabi |
|---|---|
| date | Mon, 11 Nov 2002 09:37:40 +0000 |
| parents | b1663b0ffbbc |
| children | 890b9fb44e84 |
comparison
equal
deleted
inserted
replaced
| 851:a25aed263097 | 852:c01c98206ee6 |
|---|---|
| 6 #endif | 6 #endif |
| 7 | 7 |
| 8 // private structure used to hide all internal memory allocations | 8 // private structure used to hide all internal memory allocations |
| 9 // and structures used for de/encoding - end user should | 9 // and structures used for de/encoding - end user should |
| 10 // never see any complicated structure | 10 // never see any complicated structure |
| 11 typedef struct | 11 typedef struct private_handle |
| 12 { | 12 { |
| 13 AVCodec* avcodec; | 13 AVCodec* avcodec; |
| 14 AVCodecContext avcontext; | 14 AVCodecContext avcontext; |
| 15 struct private_handle* next; | |
| 16 struct private_handle* prev; | |
| 15 } private_handle_t; | 17 } private_handle_t; |
| 18 | |
| 19 static private_handle_t* handle_first = 0; | |
| 16 | 20 |
| 17 static AVCodec* avcodec_find_by_fcc(uint32_t fcc) | 21 static AVCodec* avcodec_find_by_fcc(uint32_t fcc) |
| 18 { | 22 { |
| 19 // translation table | 23 // translation table |
| 20 static const struct fcc_to_avcodecid { | 24 static const struct fcc_to_avcodecid { |
| 21 enum CodecID codec; | 25 enum CodecID codec; |
| 22 uint32_t list[4]; // maybe we could map more fcc to same codec | 26 uint32_t list[4]; // maybe we could map more fcc to same codec |
| 23 } lc[] = { | 27 } lc[] = { |
| 24 { CODEC_ID_H263, { MKTAG('U', '2', '6', '3'), 0 } }, | 28 { CODEC_ID_H263, { MKTAG('U', '2', '6', '3'), 0 } }, |
| 25 { CODEC_ID_H263I, { MKTAG('I', '2', '6', '3'), 0 } }, | 29 { CODEC_ID_H263I, { MKTAG('I', '2', '6', '3'), 0 } }, |
| 26 { CODEC_ID_MSMPEG4, { MKTAG('D', 'I', 'V', '3'), 0 } }, | 30 { CODEC_ID_MSMPEG4V3, { MKTAG('D', 'I', 'V', '3'), 0 } }, |
| 27 { CODEC_ID_MPEG4, { MKTAG('D', 'I', 'V', 'X'), MKTAG('D', 'X', '5', '0'), 0 } }, | 31 { CODEC_ID_MPEG4, { MKTAG('D', 'I', 'V', 'X'), MKTAG('D', 'X', '5', '0'), 0 } }, |
| 28 { CODEC_ID_MSMPEG4V2, { MKTAG('M', 'P', '4', '2'), 0 } }, | 32 { CODEC_ID_MSMPEG4V2, { MKTAG('M', 'P', '4', '2'), 0 } }, |
| 29 { CODEC_ID_MJPEG, { MKTAG('M', 'J', 'P', 'G'), 0 } }, | 33 { CODEC_ID_MJPEG, { MKTAG('M', 'J', 'P', 'G'), 0 } }, |
| 30 { CODEC_ID_MPEG1VIDEO, { MKTAG('P', 'I', 'M', '1'), 0 } }, | 34 { CODEC_ID_MPEG1VIDEO, { MKTAG('P', 'I', 'M', '1'), 0 } }, |
| 31 { CODEC_ID_AC3, { 0x2000, 0 } }, | 35 { CODEC_ID_AC3, { 0x2000, 0 } }, |
| 49 static private_handle_t* create_handle() | 53 static private_handle_t* create_handle() |
| 50 { | 54 { |
| 51 private_handle_t* t = malloc(sizeof(private_handle_t)); | 55 private_handle_t* t = malloc(sizeof(private_handle_t)); |
| 52 if (!t) | 56 if (!t) |
| 53 return NULL; | 57 return NULL; |
| 58 memset(t, 0, sizeof(*t)); | |
| 54 | 59 |
| 55 // register and fill | 60 // register and fill |
| 56 avcodec_init(); | 61 if (!handle_first) |
| 57 avcodec_register_all(); | 62 { |
| 63 avcodec_init(); | |
| 64 avcodec_register_all(); | |
| 65 handle_first = t; | |
| 66 } | |
| 67 else | |
| 68 { | |
| 69 t->prev = handle_first->next; | |
| 70 handle_first->next = t; | |
| 71 t->next = handle_first; | |
| 72 } | |
| 73 | |
| 58 return t; | 74 return t; |
| 59 } | 75 } |
| 60 | 76 |
| 61 static void destroy_handle(private_handle_t* handle) | 77 static void destroy_handle(private_handle_t* handle) |
| 62 { | 78 { |
