Reset rotation value when encoder is closed

This commit is contained in:
bossiel 2015-05-18 04:03:22 +00:00
parent b05d823e18
commit abd5542116
3 changed files with 21 additions and 18 deletions

View File

@ -828,6 +828,7 @@ int tdav_codec_h264_close_encoder(tdav_codec_h264_t* self)
TSK_FREE(self->encoder.buffer);
}
self->encoder.frame_count = 0;
self->encoder.rotation = 0; // reset rotation
return 0;
}

View File

@ -718,6 +718,7 @@ static int tdav_codec_h264_cisco_close_encoder(tdav_codec_h264_cisco_t* self)
tsk_mutex_destroy(&self->encoder.mutex);
}
self->encoder.frame_count = 0;
self->encoder.rotation = 0; // reset rotation
}
return 0;
}
@ -778,22 +779,22 @@ static int tdav_codec_h264_cisco_close_decoder(tdav_codec_h264_cisco_t* self)
static ELevelIdc tdav_codec_h264_cisco_convert_level(enum level_idc_e level)
{
switch(level) {
case level_idc_1_0: return LEVEL_1_0;
case level_idc_1_b: return LEVEL_1_B;
case level_idc_1_1: return LEVEL_1_1;
case level_idc_1_2: return LEVEL_1_2;
case level_idc_1_3: return LEVEL_1_3;
case level_idc_2_0: return LEVEL_2_0;
case level_idc_2_1: return LEVEL_2_1;
case level_idc_2_2: return LEVEL_2_2;
case level_idc_3_0: return LEVEL_3_0;
case level_idc_3_1: return LEVEL_3_1;
case level_idc_3_2: return LEVEL_3_2;
case level_idc_4_0: return LEVEL_4_0;
case level_idc_4_1: return LEVEL_4_1;
case level_idc_4_2: return LEVEL_4_2;
case level_idc_5_0: return LEVEL_5_0;
case level_idc_5_1: return LEVEL_5_1;
case level_idc_1_0: return LEVEL_1_0;
case level_idc_1_b: return LEVEL_1_B;
case level_idc_1_1: return LEVEL_1_1;
case level_idc_1_2: return LEVEL_1_2;
case level_idc_1_3: return LEVEL_1_3;
case level_idc_2_0: return LEVEL_2_0;
case level_idc_2_1: return LEVEL_2_1;
case level_idc_2_2: return LEVEL_2_2;
case level_idc_3_0: return LEVEL_3_0;
case level_idc_3_1: return LEVEL_3_1;
case level_idc_3_2: return LEVEL_3_2;
case level_idc_4_0: return LEVEL_4_0;
case level_idc_4_1: return LEVEL_4_1;
case level_idc_4_2: return LEVEL_4_2;
case level_idc_5_0: return LEVEL_5_0;
case level_idc_5_1: return LEVEL_5_1;
case level_idc_5_2: return LEVEL_2_2;
default: return LEVEL_UNKNOWN;
}

View File

@ -175,7 +175,7 @@ static int tdav_codec_vp8_set(tmedia_codec_t* self, const tmedia_param_t* param)
else if (tsk_striequals(param->key, "rotation")) {
// IMPORTANT: changing resolution requires at least libvpx v1.1.0 "Eider"
int32_t rotation = *((int32_t*)param->value);
if(vp8->encoder.rotation != rotation){
if (vp8->encoder.rotation != rotation) {
vp8->encoder.rotation = rotation;
vp8->encoder.cfg.g_w = (rotation == 90 || rotation == 270) ? TMEDIA_CODEC_VIDEO(vp8)->out.height : TMEDIA_CODEC_VIDEO(vp8)->out.width;
vp8->encoder.cfg.g_h = (rotation == 90 || rotation == 270) ? TMEDIA_CODEC_VIDEO(vp8)->out.width : TMEDIA_CODEC_VIDEO(vp8)->out.height;
@ -836,10 +836,11 @@ int tdav_codec_vp8_open_decoder(tdav_codec_vp8_t* self)
int tdav_codec_vp8_close_encoder(tdav_codec_vp8_t* self)
{
TSK_DEBUG_INFO("tdav_codec_vp8_close_encoder(begin)");
if(self->encoder.initialized){
if (self->encoder.initialized) {
vpx_codec_destroy(&self->encoder.context);
self->encoder.initialized = tsk_false;
}
self->encoder.rotation = 0; // reset rotation
TSK_DEBUG_INFO("tdav_codec_vp8_close_encoder(end)");
return 0;
}