comparison libdirac_libschro.c @ 10060:965220ebc611 libavcodec

cosmetics: indentation, prettyprinting, K&R coding style
author diego
date Sat, 15 Aug 2009 11:42:15 +0000
parents 646065f63290
children 7dd2a45249a9
comparison
equal deleted inserted replaced
10059:c6ace59701ce 10060:965220ebc611
43 { 1920, 1080, 50, 1 }, 43 { 1920, 1080, 50, 1 },
44 { 2048, 1080, 24, 1 }, 44 { 2048, 1080, 24, 1 },
45 { 4096, 2160, 24, 1 }, 45 { 4096, 2160, 24, 1 },
46 }; 46 };
47 47
48 unsigned int ff_dirac_schro_get_video_format_idx (AVCodecContext *avccontext) 48 unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext)
49 { 49 {
50 unsigned int ret_idx = 0; 50 unsigned int ret_idx = 0;
51 unsigned int idx; 51 unsigned int idx;
52 unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) / 52 unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) /
53 sizeof(ff_dirac_schro_video_format_info[0]); 53 sizeof(ff_dirac_schro_video_format_info[0]);
54 54
55 for (idx = 1 ; idx < num_formats; ++idx ) { 55 for (idx = 1; idx < num_formats; ++idx) {
56 const FfmpegDiracSchroVideoFormatInfo *vf = 56 const FfmpegDiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx];
57 &ff_dirac_schro_video_format_info[idx];
58 if (avccontext->width == vf->width && 57 if (avccontext->width == vf->width &&
59 avccontext->height == vf->height){ 58 avccontext->height == vf->height) {
60 ret_idx = idx; 59 ret_idx = idx;
61 if (avccontext->time_base.den == vf->frame_rate_num && 60 if (avccontext->time_base.den == vf->frame_rate_num &&
62 avccontext->time_base.num == vf->frame_rate_denom) 61 avccontext->time_base.num == vf->frame_rate_denom)
63 return idx; 62 return idx;
64 } 63 }
65 } 64 }
66 return ret_idx; 65 return ret_idx;
67 } 66 }
68 67
69 void ff_dirac_schro_queue_init (FfmpegDiracSchroQueue *queue) 68 void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue)
70 { 69 {
71 queue->p_head = queue->p_tail = NULL; 70 queue->p_head = queue->p_tail = NULL;
72 queue->size = 0; 71 queue->size = 0;
73 } 72 }
74 73
75 void ff_dirac_schro_queue_free (FfmpegDiracSchroQueue *queue, 74 void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue,
76 void (*free_func)(void *)) 75 void (*free_func)(void *))
77 { 76 {
78 while (queue->p_head) 77 while (queue->p_head)
79 free_func( ff_dirac_schro_queue_pop(queue) ); 78 free_func(ff_dirac_schro_queue_pop(queue));
80 } 79 }
81 80
82 int ff_dirac_schro_queue_push_back (FfmpegDiracSchroQueue *queue, void *p_data) 81 int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data)
83 { 82 {
84 FfmpegDiracSchroQueueElement *p_new = 83 FfmpegDiracSchroQueueElement *p_new = av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
85 av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
86 84
87 if (!p_new) 85 if (!p_new)
88 return -1; 86 return -1;
89 87
90 p_new->data = p_data; 88 p_new->data = p_data;
97 95
98 ++queue->size; 96 ++queue->size;
99 return 0; 97 return 0;
100 } 98 }
101 99
102 void *ff_dirac_schro_queue_pop (FfmpegDiracSchroQueue *queue) 100 void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue)
103 { 101 {
104 FfmpegDiracSchroQueueElement *top = queue->p_head; 102 FfmpegDiracSchroQueueElement *top = queue->p_head;
105 103
106 if (top) { 104 if (top) {
107 void *data = top->data; 105 void *data = top->data;
108 queue->p_head = queue->p_head->next; 106 queue->p_head = queue->p_head->next;
109 --queue->size; 107 --queue->size;
110 av_freep (&top); 108 av_freep(&top);
111 return data; 109 return data;
112 } 110 }
113 111
114 return NULL; 112 return NULL;
115 } 113 }