comparison x264.c @ 2979:bfabfdf9ce55 libavcodec

COSMETICS: tabs --> spaces, some prettyprinting
author diego
date Thu, 22 Dec 2005 01:10:11 +0000
parents 0c8eec04b26c
children bf34de4233a0
comparison
equal deleted inserted replaced
2978:403183bbb505 2979:bfabfdf9ce55
30 30
31 static void 31 static void
32 X264_log(void *p, int level, const char *fmt, va_list args) 32 X264_log(void *p, int level, const char *fmt, va_list args)
33 { 33 {
34 static const int level_map[] = { 34 static const int level_map[] = {
35 [X264_LOG_ERROR] = AV_LOG_ERROR, 35 [X264_LOG_ERROR] = AV_LOG_ERROR,
36 [X264_LOG_WARNING] = AV_LOG_ERROR, 36 [X264_LOG_WARNING] = AV_LOG_ERROR,
37 [X264_LOG_INFO] = AV_LOG_INFO, 37 [X264_LOG_INFO] = AV_LOG_INFO,
38 [X264_LOG_DEBUG] = AV_LOG_DEBUG 38 [X264_LOG_DEBUG] = AV_LOG_DEBUG
39 }; 39 };
40 40
41 if(level < 0 || level > X264_LOG_DEBUG) 41 if(level < 0 || level > X264_LOG_DEBUG)
42 return; 42 return;
43 43
44 av_vlog(p, level_map[level], fmt, args); 44 av_vlog(p, level_map[level], fmt, args);
45 } 45 }
46 46
47 47
50 { 50 {
51 uint8_t *p = buf; 51 uint8_t *p = buf;
52 int i; 52 int i;
53 53
54 for(i = 0; i < nnal; i++){ 54 for(i = 0; i < nnal; i++){
55 int s = x264_nal_encode(p, &size, 1, nals + i); 55 int s = x264_nal_encode(p, &size, 1, nals + i);
56 if(s < 0) 56 if(s < 0)
57 return -1; 57 return -1;
58 p += s; 58 p += s;
59 } 59 }
60 60
61 return p - buf; 61 return p - buf;
62 } 62 }
63 63
72 72
73 x4->pic.img.i_csp = X264_CSP_I420; 73 x4->pic.img.i_csp = X264_CSP_I420;
74 x4->pic.img.i_plane = 3; 74 x4->pic.img.i_plane = 3;
75 75
76 for(i = 0; i < 3; i++){ 76 for(i = 0; i < 3; i++){
77 x4->pic.img.plane[i] = frame->data[i]; 77 x4->pic.img.plane[i] = frame->data[i];
78 x4->pic.img.i_stride[i] = frame->linesize[i]; 78 x4->pic.img.i_stride[i] = frame->linesize[i];
79 } 79 }
80 80
81 x4->pic.i_pts = frame->pts; 81 x4->pic.i_pts = frame->pts;
82 x4->pic.i_type = X264_TYPE_AUTO; 82 x4->pic.i_type = X264_TYPE_AUTO;
83 83
84 if(x264_encoder_encode(x4->enc, &nal, &nnal, &x4->pic, &pic_out)) 84 if(x264_encoder_encode(x4->enc, &nal, &nnal, &x4->pic, &pic_out))
85 return -1; 85 return -1;
86 86
87 bufsize = encode_nals(buf, bufsize, nal, nnal); 87 bufsize = encode_nals(buf, bufsize, nal, nnal);
88 if(bufsize < 0) 88 if(bufsize < 0)
89 return -1; 89 return -1;
90 90
91 /* FIXME: dts */ 91 /* FIXME: dts */
92 x4->out_pic.pts = pic_out.i_pts; 92 x4->out_pic.pts = pic_out.i_pts;
93 93
94 switch(pic_out.i_type){ 94 switch(pic_out.i_type){
115 X264_close(AVCodecContext *avctx) 115 X264_close(AVCodecContext *avctx)
116 { 116 {
117 X264Context *x4 = avctx->priv_data; 117 X264Context *x4 = avctx->priv_data;
118 118
119 if(x4->enc) 119 if(x4->enc)
120 x264_encoder_close(x4->enc); 120 x264_encoder_close(x4->enc);
121 121
122 return 0; 122 return 0;
123 } 123 }
124 124
125 extern int 125 extern int