Lines 138-147
Link Here
|
138 |
int clean_lavc (void* arg) |
138 |
int clean_lavc (void* arg) |
139 |
{ |
139 |
{ |
140 |
struct lavcData** data= (struct lavcData**) arg; |
140 |
struct lavcData** data= (struct lavcData**) arg; |
141 |
int enc_frames =0; |
141 |
//int enc_frames =0; |
142 |
if(*data) |
142 |
if(*data) |
143 |
{ |
143 |
{ |
144 |
enc_frames = (*data)->codec_context->real_pict_num; |
144 |
//enc_frames = (*data)->codec_context->real_pict_num; |
145 |
avcodec_flush_buffers((*data)->codec_context); |
145 |
avcodec_flush_buffers((*data)->codec_context); |
146 |
//close codec |
146 |
//close codec |
147 |
avcodec_close((*data)->codec_context); |
147 |
avcodec_close((*data)->codec_context); |
Lines 154-160
Link Here
|
154 |
g_free(*data); |
154 |
g_free(*data); |
155 |
*data = NULL; |
155 |
*data = NULL; |
156 |
} |
156 |
} |
157 |
return (enc_frames); |
157 |
return (0); |
158 |
} |
158 |
} |
159 |
|
159 |
|
160 |
int clean_lavc_audio (void* arg) |
160 |
int clean_lavc_audio (void* arg) |
Lines 160-169
Link Here
|
160 |
int clean_lavc_audio (void* arg) |
160 |
int clean_lavc_audio (void* arg) |
161 |
{ |
161 |
{ |
162 |
struct lavcAData** data= (struct lavcAData**) arg; |
162 |
struct lavcAData** data= (struct lavcAData**) arg; |
163 |
int enc_frames =0; |
163 |
//int enc_frames =0; |
164 |
if(*data) |
164 |
if(*data) |
165 |
{ |
165 |
{ |
166 |
enc_frames = (*data)->codec_context->real_pict_num; |
166 |
//enc_frames = (*data)->codec_context->real_pict_num; |
167 |
avcodec_flush_buffers((*data)->codec_context); |
167 |
avcodec_flush_buffers((*data)->codec_context); |
168 |
//close codec |
168 |
//close codec |
169 |
avcodec_close((*data)->codec_context); |
169 |
avcodec_close((*data)->codec_context); |
Lines 174-180
Link Here
|
174 |
g_free(*data); |
174 |
g_free(*data); |
175 |
*data = NULL; |
175 |
*data = NULL; |
176 |
} |
176 |
} |
177 |
return (enc_frames); |
177 |
return (0); |
178 |
} |
178 |
} |
179 |
struct lavcData* init_lavc(int width, int height, int fps_num, int fps_den, int codec_ind) |
179 |
struct lavcData* init_lavc(int width, int height, int fps_num, int fps_den, int codec_ind) |
Lines 240-246
Link Here
|
240 |
data->codec_context->qblur = defaults->qblur; |
240 |
data->codec_context->qblur = defaults->qblur; |
241 |
data->codec_context->strict_std_compliance = FF_COMPLIANCE_NORMAL; |
241 |
data->codec_context->strict_std_compliance = FF_COMPLIANCE_NORMAL; |
242 |
data->codec_context->codec_id = defaults->codec_id; |
242 |
data->codec_context->codec_id = defaults->codec_id; |
|
|
243 |
#ifdef CODEC_TYPE_VIDEO |
243 |
data->codec_context->codec_type = CODEC_TYPE_VIDEO; |
244 |
data->codec_context->codec_type = CODEC_TYPE_VIDEO; |
|
|
245 |
#endif |
244 |
data->codec_context->pix_fmt = PIX_FMT_YUV420P; //only yuv420p available for mpeg |
246 |
data->codec_context->pix_fmt = PIX_FMT_YUV420P; //only yuv420p available for mpeg |
245 |
if(defaults->fps) |
247 |
if(defaults->fps) |
246 |
data->codec_context->time_base = (AVRational){1,defaults->fps}; //use properties fps |
248 |
data->codec_context->time_base = (AVRational){1,defaults->fps}; //use properties fps |
Lines 299-306
Link Here
|
299 |
data->codec_context->cutoff = 0; /*automatic*/ |
301 |
data->codec_context->cutoff = 0; /*automatic*/ |
300 |
//data->codec_context->sample_fmt = SAMPLE_FMT_FLT; /* floating point sample */ |
302 |
//data->codec_context->sample_fmt = SAMPLE_FMT_FLT; /* floating point sample */ |
301 |
data->codec_context->codec_id = defaults->codec_id; |
303 |
data->codec_context->codec_id = defaults->codec_id; |
|
|
304 |
#ifdef CODEC_TYPE_AUDIO |
302 |
data->codec_context->codec_type = CODEC_TYPE_AUDIO; |
305 |
data->codec_context->codec_type = CODEC_TYPE_AUDIO; |
303 |
|
306 |
#endif |
304 |
// open codec |
307 |
// open codec |
305 |
if (avcodec_open(data->codec_context, data->codec) < 0) |
308 |
if (avcodec_open(data->codec_context, data->codec) < 0) |
306 |
{ |
309 |
{ |