finish adding support for (real) arbitrary video size decoding

This commit is contained in:
bossiel 2011-07-29 02:30:45 +00:00
parent ab372e958c
commit 3e01f88c29
20 changed files with 244 additions and 50 deletions

View File

@ -445,12 +445,26 @@ int ProxyVideoProducer::getRotation()const
return m_nRotation;
}
void ProxyVideoProducer::setRotation(int nRot)
bool ProxyVideoProducer::setRotation(int nRot)
{
m_nRotation = nRot;
if(m_pWrappedPlugin){
TMEDIA_PRODUCER(m_pWrappedPlugin)->video.rotation = m_nRotation;
return true;
}
return false;
}
// alert the encoder which size your camera is using because it's very hard to retrieve it from send(buffer, size) function
// this function is only needed if the actual size (output from your camera) is different than the negociated one
bool ProxyVideoProducer::setActualCameraOutputSize(unsigned nWidth, unsigned nHeight)
{
if(m_pWrappedPlugin){
TMEDIA_PRODUCER(m_pWrappedPlugin)->video.width = nWidth;
TMEDIA_PRODUCER(m_pWrappedPlugin)->video.height = nHeight;
return true;
}
return false;
}
// encode() then send()

View File

@ -110,7 +110,8 @@ public:
virtual ~ProxyVideoProducer();
int getRotation()const;
void setRotation(int nRot);
bool setRotation(int nRot);
bool setActualCameraOutputSize(unsigned nWidth, unsigned nHeight);
int push(const void* pBuffer, unsigned nSize);
int send(const void* pBuffer, unsigned nSize, unsigned nDuration, bool bMarker);
void setCallback(ProxyVideoProducerCallback* pCallback) { m_pCallback = pCallback; }

View File

@ -43,8 +43,14 @@ public class ProxyVideoProducer : ProxyPlugin {
return ret;
}
public void setRotation(int nRot) {
tinyWRAPPINVOKE.ProxyVideoProducer_setRotation(swigCPtr, nRot);
public bool setRotation(int nRot) {
bool ret = tinyWRAPPINVOKE.ProxyVideoProducer_setRotation(swigCPtr, nRot);
return ret;
}
public bool setActualCameraOutputSize(uint nWidth, uint nHeight) {
bool ret = tinyWRAPPINVOKE.ProxyVideoProducer_setActualCameraOutputSize(swigCPtr, nWidth, nHeight);
return ret;
}
public int push(byte[] pBuffer, uint nSize) {

View File

@ -1143,7 +1143,10 @@ class tinyWRAPPINVOKE {
public static extern int ProxyVideoProducer_getRotation(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_setRotation")]
public static extern void ProxyVideoProducer_setRotation(HandleRef jarg1, int jarg2);
public static extern bool ProxyVideoProducer_setRotation(HandleRef jarg1, int jarg2);
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_setActualCameraOutputSize")]
public static extern bool ProxyVideoProducer_setActualCameraOutputSize(HandleRef jarg1, uint jarg2, uint jarg3);
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_push")]
public static extern int ProxyVideoProducer_push(HandleRef jarg1, byte[] jarg2, uint jarg3);

View File

@ -5116,13 +5116,33 @@ SWIGEXPORT int SWIGSTDCALL CSharp_ProxyVideoProducer_getRotation(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_ProxyVideoProducer_setRotation(void * jarg1, int jarg2) {
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ProxyVideoProducer_setRotation(void * jarg1, int jarg2) {
unsigned int jresult ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
int arg2 ;
bool result;
arg1 = (ProxyVideoProducer *)jarg1;
arg2 = (int)jarg2;
(arg1)->setRotation(arg2);
result = (bool)(arg1)->setRotation(arg2);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ProxyVideoProducer_setActualCameraOutputSize(void * jarg1, unsigned int jarg2, unsigned int jarg3) {
unsigned int jresult ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
bool result;
arg1 = (ProxyVideoProducer *)jarg1;
arg2 = (unsigned int)jarg2;
arg3 = (unsigned int)jarg3;
result = (bool)(arg1)->setActualCameraOutputSize(arg2,arg3);
jresult = result;
return jresult;
}

View File

@ -37,8 +37,12 @@ public class ProxyVideoProducer extends ProxyPlugin {
return tinyWRAPJNI.ProxyVideoProducer_getRotation(swigCPtr, this);
}
public void setRotation(int nRot) {
tinyWRAPJNI.ProxyVideoProducer_setRotation(swigCPtr, this, nRot);
public boolean setRotation(int nRot) {
return tinyWRAPJNI.ProxyVideoProducer_setRotation(swigCPtr, this, nRot);
}
public boolean setActualCameraOutputSize(long nWidth, long nHeight) {
return tinyWRAPJNI.ProxyVideoProducer_setActualCameraOutputSize(swigCPtr, this, nWidth, nHeight);
}
public int push(java.nio.ByteBuffer pBuffer, long nSize) {

View File

@ -37,8 +37,12 @@ public class ProxyVideoProducer extends ProxyPlugin {
return tinyWRAPJNI.ProxyVideoProducer_getRotation(swigCPtr, this);
}
public void setRotation(int nRot) {
tinyWRAPJNI.ProxyVideoProducer_setRotation(swigCPtr, this, nRot);
public boolean setRotation(int nRot) {
return tinyWRAPJNI.ProxyVideoProducer_setRotation(swigCPtr, this, nRot);
}
public boolean setActualCameraOutputSize(long nWidth, long nHeight) {
return tinyWRAPJNI.ProxyVideoProducer_setActualCameraOutputSize(swigCPtr, this, nWidth, nHeight);
}
public int push(java.nio.ByteBuffer pBuffer, long nSize) {

View File

@ -334,7 +334,8 @@ class tinyWRAPJNI {
public final static native void ProxyVideoProducerCallback_change_ownership(ProxyVideoProducerCallback obj, long cptr, boolean take_or_release);
public final static native void delete_ProxyVideoProducer(long jarg1);
public final static native int ProxyVideoProducer_getRotation(long jarg1, ProxyVideoProducer jarg1_);
public final static native void ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
public final static native boolean ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
public final static native boolean ProxyVideoProducer_setActualCameraOutputSize(long jarg1, ProxyVideoProducer jarg1_, long jarg2, long jarg3);
public final static native int ProxyVideoProducer_push(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
public final static native int ProxyVideoProducer_send(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, boolean jarg5);
public final static native void ProxyVideoProducer_setCallback(long jarg1, ProxyVideoProducer jarg1_, long jarg2, ProxyVideoProducerCallback jarg2_);

View File

@ -7345,16 +7345,39 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProduce
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setRotation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setRotation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jboolean jresult = 0 ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
int arg2 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ProxyVideoProducer **)&jarg1;
arg2 = (int)jarg2;
(arg1)->setRotation(arg2);
result = (bool)(arg1)->setRotation(arg2);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setActualCameraOutputSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
jboolean jresult = 0 ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ProxyVideoProducer **)&jarg1;
arg2 = (unsigned int)jarg2;
arg3 = (unsigned int)jarg3;
result = (bool)(arg1)->setActualCameraOutputSize(arg2,arg3);
jresult = (jboolean)result;
return jresult;
}

View File

@ -334,7 +334,8 @@ class tinyWRAPJNI {
public final static native void ProxyVideoProducerCallback_change_ownership(ProxyVideoProducerCallback obj, long cptr, boolean take_or_release);
public final static native void delete_ProxyVideoProducer(long jarg1);
public final static native int ProxyVideoProducer_getRotation(long jarg1, ProxyVideoProducer jarg1_);
public final static native void ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
public final static native boolean ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
public final static native boolean ProxyVideoProducer_setActualCameraOutputSize(long jarg1, ProxyVideoProducer jarg1_, long jarg2, long jarg3);
public final static native int ProxyVideoProducer_push(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
public final static native int ProxyVideoProducer_send(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, boolean jarg5);
public final static native void ProxyVideoProducer_setCallback(long jarg1, ProxyVideoProducer jarg1_, long jarg2, ProxyVideoProducerCallback jarg2_);

View File

@ -7345,16 +7345,39 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProduce
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setRotation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setRotation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jboolean jresult = 0 ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
int arg2 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ProxyVideoProducer **)&jarg1;
arg2 = (int)jarg2;
(arg1)->setRotation(arg2);
result = (bool)(arg1)->setRotation(arg2);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setActualCameraOutputSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
jboolean jresult = 0 ;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ProxyVideoProducer **)&jarg1;
arg2 = (unsigned int)jarg2;
arg3 = (unsigned int)jarg3;
result = (bool)(arg1)->setActualCameraOutputSize(arg2,arg3);
jresult = (jboolean)result;
return jresult;
}

View File

@ -1555,6 +1555,7 @@ sub DESTROY {
*getRotation = *tinyWRAPc::ProxyVideoProducer_getRotation;
*setRotation = *tinyWRAPc::ProxyVideoProducer_setRotation;
*setActualCameraOutputSize = *tinyWRAPc::ProxyVideoProducer_setActualCameraOutputSize;
*push = *tinyWRAPc::ProxyVideoProducer_push;
*send = *tinyWRAPc::ProxyVideoProducer_send;
*setCallback = *tinyWRAPc::ProxyVideoProducer_setCallback;

View File

@ -15009,6 +15009,7 @@ XS(_wrap_ProxyVideoProducer_setRotation) {
int val2 ;
int ecode2 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 2) || (items > 2)) {
@ -15024,8 +15025,8 @@ XS(_wrap_ProxyVideoProducer_setRotation) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ProxyVideoProducer_setRotation" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
(arg1)->setRotation(arg2);
ST(argvi) = sv_newmortal();
result = (bool)(arg1)->setRotation(arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
@ -15037,6 +15038,54 @@ XS(_wrap_ProxyVideoProducer_setRotation) {
}
XS(_wrap_ProxyVideoProducer_setActualCameraOutputSize) {
{
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
unsigned int val2 ;
int ecode2 = 0 ;
unsigned int val3 ;
int ecode3 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: ProxyVideoProducer_setActualCameraOutputSize(self,nWidth,nHeight);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ProxyVideoProducer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "1"" of type '" "ProxyVideoProducer *""'");
}
arg1 = reinterpret_cast< ProxyVideoProducer * >(argp1);
ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "2"" of type '" "unsigned int""'");
}
arg2 = static_cast< unsigned int >(val2);
ecode3 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "3"" of type '" "unsigned int""'");
}
arg3 = static_cast< unsigned int >(val3);
result = (bool)(arg1)->setActualCameraOutputSize(arg2,arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_ProxyVideoProducer_push) {
{
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
@ -21438,6 +21487,7 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::delete_ProxyVideoProducer", _wrap_delete_ProxyVideoProducer},
{"tinyWRAPc::ProxyVideoProducer_getRotation", _wrap_ProxyVideoProducer_getRotation},
{"tinyWRAPc::ProxyVideoProducer_setRotation", _wrap_ProxyVideoProducer_setRotation},
{"tinyWRAPc::ProxyVideoProducer_setActualCameraOutputSize", _wrap_ProxyVideoProducer_setActualCameraOutputSize},
{"tinyWRAPc::ProxyVideoProducer_push", _wrap_ProxyVideoProducer_push},
{"tinyWRAPc::ProxyVideoProducer_send", _wrap_ProxyVideoProducer_send},
{"tinyWRAPc::ProxyVideoProducer_setCallback", _wrap_ProxyVideoProducer_setCallback},

View File

@ -1015,6 +1015,7 @@ class ProxyVideoProducer(ProxyPlugin):
__del__ = lambda self : None;
def getRotation(self): return _tinyWRAP.ProxyVideoProducer_getRotation(self)
def setRotation(self, *args): return _tinyWRAP.ProxyVideoProducer_setRotation(self, *args)
def setActualCameraOutputSize(self, *args): return _tinyWRAP.ProxyVideoProducer_setActualCameraOutputSize(self, *args)
def push(self, *args): return _tinyWRAP.ProxyVideoProducer_push(self, *args)
def send(self, *args): return _tinyWRAP.ProxyVideoProducer_send(self, *args)
def setCallback(self, *args): return _tinyWRAP.ProxyVideoProducer_setCallback(self, *args)

View File

@ -15521,6 +15521,7 @@ SWIGINTERN PyObject *_wrap_ProxyVideoProducer_setRotation(PyObject *SWIGUNUSEDPA
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OO:ProxyVideoProducer_setRotation",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ProxyVideoProducer, 0 | 0 );
@ -15533,8 +15534,48 @@ SWIGINTERN PyObject *_wrap_ProxyVideoProducer_setRotation(PyObject *SWIGUNUSEDPA
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ProxyVideoProducer_setRotation" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
(arg1)->setRotation(arg2);
resultobj = SWIG_Py_Void();
result = (bool)(arg1)->setRotation(arg2);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_ProxyVideoProducer_setActualCameraOutputSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
unsigned int val2 ;
int ecode2 = 0 ;
unsigned int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OOO:ProxyVideoProducer_setActualCameraOutputSize",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ProxyVideoProducer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "1"" of type '" "ProxyVideoProducer *""'");
}
arg1 = reinterpret_cast< ProxyVideoProducer * >(argp1);
ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "2"" of type '" "unsigned int""'");
}
arg2 = static_cast< unsigned int >(val2);
ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ProxyVideoProducer_setActualCameraOutputSize" "', argument " "3"" of type '" "unsigned int""'");
}
arg3 = static_cast< unsigned int >(val3);
result = (bool)(arg1)->setActualCameraOutputSize(arg2,arg3);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
@ -20980,6 +21021,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"delete_ProxyVideoProducer", _wrap_delete_ProxyVideoProducer, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_getRotation", _wrap_ProxyVideoProducer_getRotation, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_setRotation", _wrap_ProxyVideoProducer_setRotation, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_setActualCameraOutputSize", _wrap_ProxyVideoProducer_setActualCameraOutputSize, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_push", _wrap_ProxyVideoProducer_push, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_send", _wrap_ProxyVideoProducer_send, METH_VARARGS, NULL},
{ (char *)"ProxyVideoProducer_setCallback", _wrap_ProxyVideoProducer_setCallback, METH_VARARGS, NULL},

View File

@ -753,6 +753,8 @@ tsk_size_t tdav_codec_h263p_decode(tmedia_codec_t* self, const void* in_data, ts
}
else{
retsize = xsize;
TMEDIA_CODEC_VIDEO(h263)->in.width = h263->decoder.context->width;
TMEDIA_CODEC_VIDEO(h263)->in.height = h263->decoder.context->height;
// flip
if(self->video.flip.decoded){
tdav_converter_video_flip(h263->decoder.picture, h263->decoder.context->height);

View File

@ -445,7 +445,7 @@ tsk_bool_t tdav_codec_h264_fmtp_match(const tmedia_codec_t* codec, const char* f
if((val_str = tsk_params_get_param_value(params, "profile-level-id"))){
level_idc_t l_idc;
int std_w, std_h;
/* profile-idc and level-idc alreasy tested by tdav_codec_h264_get_profile() */
/* profile-idc and level-idc already tested by tdav_codec_h264_get_profile() */
tdav_codec_h264_parse_profile(val_str, tsk_null, tsk_null, &l_idc);
switch(l_idc){
case level_idc_1_0:
@ -460,13 +460,16 @@ tsk_bool_t tdav_codec_h264_fmtp_match(const tmedia_codec_t* codec, const char* f
//set it high to avoid overflow on the accumulator (codec::open)
// will be update with codec::context after first successful decode
TMEDIA_CODEC_VIDEO(h264)->in.width = 680, TMEDIA_CODEC_VIDEO(h264)->in.height = 480;
TMEDIA_CODEC_VIDEO(h264)->in.width = std_w, TMEDIA_CODEC_VIDEO(h264)->in.height = std_h;
if(sx > 0 && sy > 0){
while((sx > std_w && sy > std_h) || (sx > std_h && sy > std_w)){
sx >>= 1;
sy >>= 1;
}
TMEDIA_CODEC_VIDEO(h264)->out.width = sx&(~1), TMEDIA_CODEC_VIDEO(h264)->out.height = sy&(~1);
//while((sx > std_w && sy > std_h) || (sx > std_h && sy > std_w)){
// sx >>= 1;
// sy >>= 1;
//}
TMEDIA_CODEC_VIDEO(h264)->out.width = sx&(~1), TMEDIA_CODEC_VIDEO(h264)->in.height = sy&(~1);
}
else{
TMEDIA_CODEC_VIDEO(h264)->out.width = std_w, TMEDIA_CODEC_VIDEO(h264)->in.height = std_h;
}
}
}

View File

@ -83,14 +83,14 @@ static int tdav_session_video_rtp_cb(const void* callback_data, const struct trt
// Convert decoded data to the consumer chroma and size
#define CONSUMER_INSIZE_CHANGED ((session->consumer->video.in.width * session->consumer->video.in.height * 3)/2 != out_size)// we have good reasons not to use 1.5f
#define CONSUMER_DISPLAY_NEED_RESIZE (session->consumer->video.in.width != session->consumer->video.display.width || session->consumer->video.in.height != session->consumer->video.display.height)
#define CONSUMER_DISPLAYSIZE_CHANGED (session->conv.consumerLastWidth != session->consumer->video.display.width || session->conv.consumerLastHeight != session->consumer->video.display.height)
#define CONSUMER_DECODED_HAS_DIFF_SIZE (session->consumer->video.display.width != TMEDIA_CODEC_VIDEO(codec)->in.width || session->consumer->video.display.height != TMEDIA_CODEC_VIDEO(codec)->in.height)
#define CONSUMER_DISPLAY_NEED_CHROMACHANGE (session->consumer->video.display.chroma != tmedia_yuv420p)
if((CONSUMER_DISPLAY_NEED_CHROMACHANGE || CONSUMER_DISPLAYSIZE_CHANGED || CONSUMER_DISPLAY_NEED_RESIZE || CONSUMER_INSIZE_CHANGED)){
if((CONSUMER_DISPLAY_NEED_CHROMACHANGE || CONSUMER_DECODED_HAS_DIFF_SIZE || CONSUMER_DISPLAY_NEED_RESIZE || CONSUMER_INSIZE_CHANGED)){
tsk_size_t _output_size;
// Create video converter if not already done
if(!session->conv.fromYUV420 || CONSUMER_DISPLAYSIZE_CHANGED || CONSUMER_INSIZE_CHANGED){
if(!session->conv.fromYUV420 || CONSUMER_DECODED_HAS_DIFF_SIZE || CONSUMER_INSIZE_CHANGED){
TSK_OBJECT_SAFE_FREE(session->conv.fromYUV420);
// update in (set by the codec)
session->consumer->video.in.width = TMEDIA_CODEC_VIDEO(codec)->in.width;//decoded width
@ -101,10 +101,8 @@ static int tdav_session_video_rtp_cb(const void* callback_data, const struct trt
session->consumer->video.display.width = session->consumer->video.in.width;
session->consumer->video.display.height = session->consumer->video.in.height;
}
// set xdisplay with latest valid sizes (set by the user)
session->conv.consumerLastWidth = session->consumer->video.display.width;
session->conv.consumerLastHeight = session->consumer->video.display.height;
if(!(session->conv.fromYUV420 = tdav_converter_video_create(TMEDIA_CODEC_VIDEO(codec)->in.width, TMEDIA_CODEC_VIDEO(codec)->in.height, session->conv.consumerLastWidth, session->conv.consumerLastHeight,
// create converter
if(!(session->conv.fromYUV420 = tdav_converter_video_create(TMEDIA_CODEC_VIDEO(codec)->in.width, TMEDIA_CODEC_VIDEO(codec)->in.height, session->consumer->video.display.width, session->consumer->video.display.height,
session->consumer->video.display.chroma, tsk_false))){
TSK_DEBUG_ERROR("Failed to create video converter");
ret = -3;

View File

@ -36,11 +36,7 @@ typedef struct tdshow_producer_s
DSGrabber* grabber;
INT64 previewHwnd;
int fps;
int width;
int height;
tsk_bool_t started;
}
tdshow_producer_t;
@ -91,10 +87,11 @@ int tdshow_producer_prepare(tmedia_producer_t* self, const tmedia_codec_t* codec
return -1;
}
producer->fps = TMEDIA_CODEC_VIDEO(codec)->out.fps;
producer->width = TMEDIA_CODEC_VIDEO(codec)->out.width;
producer->height = TMEDIA_CODEC_VIDEO(codec)->out.height;
TMEDIA_PRODUCER(producer)->video.fps = TMEDIA_CODEC_VIDEO(codec)->out.fps;
// FIXME
TMEDIA_PRODUCER(producer)->video.width = 320;//TMEDIA_CODEC_VIDEO(codec)->out.width;
TMEDIA_PRODUCER(producer)->video.height = 240;//TMEDIA_CODEC_VIDEO(codec)->out.height;
return 0;
}
@ -129,7 +126,7 @@ int tdshow_producer_start(tmedia_producer_t* self)
producer->grabber->setCaptureDevice("Null");
// set parameters
producer->grabber->setCaptureParameters(producer->width, producer->height, producer->fps);
producer->grabber->setCaptureParameters(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height, TMEDIA_PRODUCER(producer)->video.fps);
// set callback function
producer->grabber->setCallback(tdshow_plugin_cb, producer);
@ -139,7 +136,7 @@ int tdshow_producer_start(tmedia_producer_t* self)
if(producer->previewHwnd){
producer->grabber->preview->attach(producer->previewHwnd);
}
producer->grabber->preview->setSize(producer->width, producer->height);
producer->grabber->preview->setSize(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height);
}
// start grabber
@ -212,9 +209,9 @@ static tsk_object_t* tdshow_producer_ctor(tsk_object_t * self, va_list * app)
tmedia_producer_init(TMEDIA_PRODUCER(producer));
TMEDIA_PRODUCER(producer)->video.chroma = tmedia_bgr24; // RGB24 on x86 (little endians) stored as BGR24
/* init self with default values*/
producer->fps = 15;
producer->width = 176;
producer->height = 144;
TMEDIA_PRODUCER(producer)->video.fps = 15;
TMEDIA_PRODUCER(producer)->video.width = 176;
TMEDIA_PRODUCER(producer)->video.height = 144;
if(IsMainThread()){
producer->grabber = new DSGrabber(&hr);

View File

@ -477,7 +477,7 @@ int tmedia_codec_to_sdp(const tmedia_codecs_L_t* codecs, tsdp_header_M_t* m)
}
/* add fmtp attributes */
if((fmtp = tmedia_codec_get_fmtp(codec))){
if(is_video){
if(is_video && tmedia_defaults_get_screen_x() > 0 && tmedia_defaults_get_screen_y() > 0){
tsk_sprintf(&temp, "%s %s;sx=%d;sy=%d", neg_format, fmtp, tmedia_defaults_get_screen_x(), tmedia_defaults_get_screen_y());//doubango clients
}
else{