Revision fb602cd1 libavcodec/avcodec.c

View differences:

libavcodec/avcodec.c
8 8
// private structure used to hide all internal memory allocations
9 9
// and structures used for de/encoding - end user should
10 10
// never see any complicated structure
11
typedef struct
11
typedef struct private_handle
12 12
{
13 13
    AVCodec* avcodec;
14 14
    AVCodecContext avcontext;
15
    struct private_handle* next;
16
    struct private_handle* prev;
15 17
} private_handle_t;
16 18

  
19
static private_handle_t* handle_first = 0;
20

  
17 21
static AVCodec* avcodec_find_by_fcc(uint32_t fcc)
18 22
{
19 23
    // translation table
......
23 27
    } lc[] = {
24 28
	{ CODEC_ID_H263, { MKTAG('U', '2', '6', '3'), 0 } },
25 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 31
	{ CODEC_ID_MPEG4, { MKTAG('D', 'I', 'V', 'X'),  MKTAG('D', 'X', '5', '0'), 0 } },
28 32
	{ CODEC_ID_MSMPEG4V2, { MKTAG('M', 'P', '4', '2'), 0 } },
29 33
	{ CODEC_ID_MJPEG, { MKTAG('M', 'J', 'P', 'G'), 0 } },
......
51 55
    private_handle_t* t = malloc(sizeof(private_handle_t));
52 56
    if (!t)
53 57
	return NULL;
58
    memset(t, 0, sizeof(*t));
54 59

  
55 60
    // register and fill
56
    avcodec_init();
57
    avcodec_register_all();
61
    if (!handle_first)
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 74
    return t;
59 75
}
60 76

  

Also available in: Unified diff