MP4Decoder Class Reference

Implementation of Adaptor that returns YUVFrame objects <short description="">. More...

#include <MP4Decoder.hpp>

Inheritance diagram for MP4Decoder:

VideoAdaptor Adaptor List of all members.

Public Types

typedef enum MP4Decoder::eCoderType meCoderType
 Codec selection enumeration, currently available are XviD and FFMPEG.
enum  eCoderType { XVID = 1, FFMPEG }
 Codec selection enumeration, currently available are XviD and FFMPEG.

Public Member Functions

 MP4Decoder (VideoESInfo *pESInfo, bool enableSwitching=false, UncompressedVideoFrame::ColorSpace colorSpace=UncompressedVideoFrame::ColorSpaceYV12, meCoderType coderType=XVID)
 Creates an uninitialized MP4Decoder instance.
virtual ~MP4Decoder ()
 Destroys the MP4Decoder.
list< Frame * > adapt (Frame *frm)
 Compressed frm in - uncompressed YUV12 frame out.
list< Frame * > close ()
 Flush all buffered uncompressed Frame objects (if any).
Adaptorclone ()
 Not implemented.
void initialize ()
 Initializes the Decoder.
void setCoderType (eCoderType coderType=XVID)
 Codec selection.
u32 getTranscodingCosts () const
 returns adaptation costs (CPU only).

Static Public Member Functions

bool isValidVisualFrame (const u8 *payload)
bool isValidDecoderConfig (const u8 *payload)
xvidColorSpace mapToXVIDColorspace (UncompressedVideoFrame::ColorSpace colorSpace)
 Mapping function between MP4Decoders colorspace (defined in UncompressedVideoFrame::ColorSpace) and XviD codec colorspace.
const char * codecToString (CodecID codec_id)
int stringToCodec (const char *codec_string)
ffmpegColorSpace mapToFFMPEGColorspace (UncompressedVideoFrame::ColorSpace colorSpace)
 Mapping function between MP4Decoders colorspace (defined in UncompressedVideoFrame::ColorSpace) and FFMPEG codec colorspace.

Detailed Description

Implementation of Adaptor that returns YUVFrame objects <short description="">.

Author:
Bernhard Penz
Version:
Id
MP4Decoder.hpp,v 1.20 2005/12/21 11:00:43 mkropfbe Exp

Definition at line 76 of file MP4Decoder.hpp.


Constructor & Destructor Documentation

MP4Decoder::MP4Decoder VideoESInfo *  pESInfo,
bool  enableSwitching = false,
UncompressedVideoFrame::ColorSpace  colorSpace = UncompressedVideoFrame::ColorSpaceYV12,
meCoderType  coderType = XVID
 

Creates an uninitialized MP4Decoder instance.

Parameters:
pESInfo Pointer to ESInfo containing VOS/VO/VOL headers
enableSwitching specifies if the decoder should reinit itself, when a new header is detected. set to false in the server, set to true in the client
colorSpace xvidColorSpace of output Frame objects. Defaults to ColorSpaceYV12.
coderType Video codec to use.
See also:
setCoderType
Definition at line 121 of file MP4Decoder.cpp.

References UncompressedVideoFrame::ColorSpace, and meCoderType.

Referenced by clone().

00121 { 00122 mpDecoder = NULL; 00123 mpOutBuf=NULL; 00124 this->enableSwitching=enableSwitching; 00125 es = pESInfo; 00126 mColorSpace = colorSpace; 00127 mFrameSize = 0; 00128 decConfig=NULL; 00129 decConfigSize=0; 00130 newDecConfig=NULL; 00131 meCoder = coderType; 00132 initialized = false; 00133 if(coderType==XVID) { 00134 dprintf_full("MP4Decoder::MP4Decoder-XVID\n"); 00135 strcpy(name,"MP4Decoder-XVID"); 00136 } 00137 else { 00138 dprintf_full("MP4Decoder::MP4Decoder-FFMPEG\n"); 00139 strcpy(name,"MP4Decoder-FFMPEG"); 00140 } 00141 auBuffer[0] = NULL; 00142 auBuffer[1] = NULL; 00143 muiWidth=0; 00144 muiHeight=0; 00145 00146 mpBuffer = new char[1024*1024*1]; //1 MByte 00147 00148 dprintf_full("MP4Decoder Construct colorSpace %s, bitDepth %i\n", 00149 colorSpace==UncompressedVideoFrame::ColorSpaceGRAY8?"RGB8gray": 00150 colorSpace==UncompressedVideoFrame::ColorSpaceRGB24?"RGB24": 00151 colorSpace==UncompressedVideoFrame::ColorSpaceRGB32?"RGB32": 00152 colorSpace==UncompressedVideoFrame::ColorSpaceRGB565?"RGB565": 00153 colorSpace==UncompressedVideoFrame::ColorSpaceI420?"I420": 00154 colorSpace==UncompressedVideoFrame::ColorSpaceYV12?"YV12": 00155 "UNKNOWN", 00156 UncompressedVideoFrame::mapColorSpaceToBitDepth(colorSpace)); 00157 }


Member Function Documentation

list< Frame * > MP4Decoder::adapt Frame frm  )  [virtual]
 

Compressed frm in - uncompressed YUV12 frame out.

Parameters:
frm Pointer to compressed Frame
Returns:
List of YUVFrame objects

Reimplemented from Adaptor.

Definition at line 354 of file MP4Decoder.cpp.

References Frame::getAU(), Frame::getMediaTimeScale(), Frame::getType(), initialize(), Frame::setAU(), Frame::setAUu(), Frame::setAUv(), Frame::setAUy(), UncompressedVideoFrame::setColorSpace(), and Frame::setMediaTimeScale().

00354 { 00355 dprintf_full("MP4Decoder::adapt frame CTS %i size %i\n",frm->getAU()->cts,frm->getAU()->size); 00356 if(es && enableSwitching) { 00357 if(decConfigSize>0) { 00358 if(newDecConfig) { 00359 delete[] newDecConfig; 00360 newDecConfig=NULL; 00361 } 00362 00363 u32 nSize=es->getHeaders(&newDecConfig); 00364 if(nSize != 0 && nSize != decConfigSize) { 00365 // we have a new decConfig 00366 if(decConfig) 00367 delete[] decConfig; 00368 decConfig=newDecConfig; 00369 newDecConfig=NULL; 00370 initialized=false; 00371 } 00372 else if(nSize == decConfigSize) { 00373 // same size but might be different 00374 if(memcmp(decConfig,newDecConfig,decConfigSize)!=0) { 00375 // is different 00376 if(decConfig) 00377 delete[] decConfig; 00378 decConfig=newDecConfig; 00379 newDecConfig=NULL; 00380 initialized=false; 00381 } 00382 } 00383 } 00384 } 00385 00386 00387 if (!initialized) 00388 initialize(); 00389 00390 list < Frame * >frmList; 00391 if (!initialized) 00392 return frmList; 00393 if(mpOutBuf) { 00394 delete[] mpOutBuf; 00395 mpOutBuf=NULL; 00396 } 00397 00398 00399 #ifndef WINCE 00400 00401 mpOutBuf = new u8[mFrameSize]; 00402 00403 // The Decoder expects in case of BFRAMES_DEC enabled the 00404 // B-Frame together with the reference frame. Therefore one frame is 00405 // always buffered for this case. 00406 if (muiFrameNumber == 0) { 00407 //first send the header to the decoder ... 00408 lenDecoded = DecodeFrame((char *) mpDecoder, mpBuffer, muiLastFrameEnd,(char *) mpOutBuf, mColorSpace); 00409 if(lenDecoded <= 0) { 00410 lenDecoded = abs(lenDecoded); 00411 dprintf_err("MP4Decoder::adapt : muiFrameNumber==0, no decoder output for header frame!\n"); 00412 } 00413 00414 // ... and then the first frame. 00415 memcpy(mpBuffer, (u8 *) frm->getAU()->payload, frm->getAU()->size); 00416 muiLastFrameEnd = frm->getAU()->size; 00417 00418 //decode but don't return the output... this saves the first frame in the ffmpeg buffer.... 00419 lenDecoded = DecodeFrame((char *) mpDecoder, mpBuffer, muiLastFrameEnd, 00420 (char *) mpOutBuf, mColorSpace); 00421 dprintf_full("MP4Decoder::adapt : muiFrameNumber==0, decoder output1 len %i\n",lenDecoded); 00422 00423 // ... and again first frame: required to cope with random access after stream switching 00424 memcpy(mpBuffer, (u8 *) frm->getAU()->payload, frm->getAU()->size); 00425 lenDecoded = DecodeFrame((char *) mpDecoder, mpBuffer, muiLastFrameEnd, 00426 (char *) mpOutBuf, mColorSpace); 00427 dprintf_full("MP4Decoder::adapt : muiFrameNumber==0, decoder output2 len %i\n",lenDecoded); 00428 00429 lenDecoded = 0; // cause this frame to be decoded at next adapt() call 00430 if(auBuffer[1]) 00431 delete auBuffer[1]; 00432 auBuffer[1] = new AU(frm->getAU()); 00433 if(mpOutBuf) { 00434 delete[] mpOutBuf; 00435 mpOutBuf=NULL; 00436 } 00437 } else { // muiFrameNumber != 0 00438 00439 00440 // int oldMuiLastFE = muiLastFrameEnd; 00441 00442 if (lenDecoded > 0) { 00443 memmove(mpBuffer, mpBuffer + lenDecoded, muiLastFrameEnd - lenDecoded); 00444 } 00445 00446 //copy input frame to mpBuffer (which is furthermore used by the decoder) 00447 //FIXME: check for BUFFER and frm->size!!! 00448 memcpy(mpBuffer + (muiLastFrameEnd - lenDecoded), 00449 (u8 *) frm->getAU()->payload, frm->getAU()->size); 00450 muiLastFrameStart = 0; 00451 00452 00453 // char *mpBufferToFrame = mpBuffer; 00454 // int currentFrameLen; 00455 muiLastFrameEnd = muiLastFrameEnd - lenDecoded + frm->getAU()->size; 00456 00457 #endif 00458 00459 if(auBuffer[0]) 00460 delete auBuffer[0]; 00461 auBuffer[0] = auBuffer[1]; 00462 //assert(auBuffer[1]); 00463 auBuffer[1] = new AU(frm->getAU()); 00464 00465 00466 #ifndef WINCE 00467 lenDecoded = DecodeFrame((char *) mpDecoder, mpBuffer, muiLastFrameEnd, (char *) mpOutBuf, mColorSpace); 00468 dprintf_full("MP4Decoder::adapt : later frames, decoder output len %i\n",lenDecoded); 00469 00470 #else 00471 00472 u8 *y,*u,*v; 00473 if (muiFrameNumber == 0) { 00474 lenDecoded = XVIDDecodeFrameCE(mpBuffer, //(char*)frm->getAU()->payload, //mpBuffer + (muiLastFrameEnd - lenDecoded), 00475 muiLastFrameEnd, 00476 y, 00477 u, 00478 v); 00479 muiLastFrameEnd = frm->getAU()->size; 00480 auBuffer[0] = new AU(frm->getAU()); 00481 } else { 00482 muiLastFrameEnd = muiLastFrameEnd - lenDecoded + frm->getAU()->size; 00483 } 00484 00485 00486 lenDecoded = XVIDDecodeFrameCE((char*)frm->getAU()->payload, //mpBuffer + (muiLastFrameEnd - lenDecoded), 00487 muiLastFrameEnd, 00488 y, 00489 u, 00490 v); 00491 00492 #endif 00493 00494 00495 if(lenDecoded <= 0) { 00496 lenDecoded = abs(lenDecoded); 00497 dprintf_err("MP4Decoder::adapt Warning: no decoder output for frame %d\n", muiFrameNumber); 00498 // dprintf_full("MP4Decoder::adapt %x %x %x %x\r\n", 00499 // (char)mpBuffer[0],(char) mpBuffer[1],(char)mpBuffer[2],(char)mpBuffer[3]); 00500 } else { 00501 //copy result (decoded frame) to new access unit... 00502 AU * pAU = auBuffer[0]; 00503 auBuffer[0]=NULL; 00504 pAU->size = mFrameSize; 00505 pAU->payload = mpOutBuf; 00506 dprintf_full("MP4Decoder::adapt Decode Frame No %d uncompressed size %d CTS %i\n", 00507 muiFrameNumber, pAU->size, pAU->cts); 00508 Frame::FrameType type; 00509 switch (mColorSpace) { 00510 case UncompressedVideoFrame::ColorSpaceGRAY8: 00511 case UncompressedVideoFrame::ColorSpaceRGB565: 00512 case UncompressedVideoFrame::ColorSpaceRGB24: 00513 case UncompressedVideoFrame::ColorSpaceRGB32: 00514 type = Frame::RGB_VOP; 00515 break; 00516 case UncompressedVideoFrame::ColorSpaceYV12: // fall through 00517 case UncompressedVideoFrame::ColorSpaceI420: 00518 type = Frame::YUV_VOP; 00519 break; 00520 default: 00521 dprintf_err("MP4Decoder::adapt: Unknown colorspace\n"); 00522 exit(-1); 00523 } 00524 UncompressedVideoFrame * decFrame = new UncompressedVideoFrame(type, muiWidth, muiHeight); 00525 decFrame->setAU(pAU); 00526 dprintf_full("MP4Decoder::adapt(): created UncompressedVideoFrame with type=%d, width=%d, height=%d (ausize=%d)\n", type, muiWidth, muiHeight, decFrame->getAU()->size); 00527 dprintf_full("MP4Decoder::adapt(): frametype = %d , type = %d\n", decFrame->getType(), type); 00528 00529 #ifdef WINCE 00530 decFrame->setAUy(y); 00531 decFrame->setAUu(u); 00532 decFrame->setAUv(v); 00533 #endif 00534 00535 decFrame->setMediaTimeScale(frm->getMediaTimeScale()); 00536 decFrame->setColorSpace(mColorSpace); 00537 frmList.push_back(decFrame); 00538 mpOutBuf=NULL; 00539 } 00540 00541 #ifndef WINCE 00542 } 00543 #endif 00544 00545 muiFrameNumber++; 00546 return frmList; 00547 }

Adaptor * MP4Decoder::clone  )  [virtual]
 

Not implemented.

Returns:
Defaults to NULL.

Implements Adaptor.

Definition at line 639 of file MP4Decoder.cpp.

References MP4Decoder().

00639 { 00640 return new MP4Decoder(es,enableSwitching,mColorSpace,meCoder); 00641 }

list< Frame * > MP4Decoder::close  )  [virtual]
 

Flush all buffered uncompressed Frame objects (if any).

Returns:
List of YUVFrame objects

Reimplemented from Adaptor.

Definition at line 551 of file MP4Decoder.cpp.

References Frame::getAU(), Frame::getType(), Frame::setAU(), Frame::setAUu(), Frame::setAUv(), Frame::setAUy(), UncompressedVideoFrame::setColorSpace(), and Frame::setMediaTimeScale().

00551 { 00552 list < Frame * >frmList; 00553 if (!initialized) 00554 return frmList; 00555 if(mpOutBuf) { 00556 delete[] mpOutBuf; 00557 mpOutBuf=NULL; 00558 } 00559 00560 mpOutBuf = new u8[mFrameSize]; 00561 #ifndef WINCE 00562 if (dec != NULL && muiFrameNumber != 0) 00563 #else 00564 if (muiFrameNumber != 0) 00565 #endif 00566 { 00567 #ifndef WINCE 00568 if (DecodeFrame((char *) mpDecoder, mpBuffer + muiLastFrameStart, 00569 muiLastFrameEnd, (char *) mpOutBuf, mColorSpace) == 0) 00570 { 00571 dprintf_err("MP4Decoder::close Error decoding frame %d\n", muiFrameNumber); 00572 delete[] mpOutBuf;mpOutBuf=NULL; 00573 if(auBuffer[1]) { 00574 delete auBuffer[1]; 00575 auBuffer[1]=NULL; 00576 } 00577 } 00578 00579 else 00580 { 00581 AU * pAU = auBuffer[1]; 00582 pAU->size = mFrameSize; 00583 pAU->payload = mpOutBuf; 00584 dprintf_full("MP4Decoder::close Decode Frame No %d uncompressed size %d CTS %i\n", 00585 muiFrameNumber, pAU->size, pAU->cts); 00586 muiFrameNumber++; 00587 Frame::FrameType type; 00588 switch (mColorSpace) { 00589 case UncompressedVideoFrame::ColorSpaceGRAY8: 00590 case UncompressedVideoFrame::ColorSpaceRGB565: 00591 case UncompressedVideoFrame::ColorSpaceRGB24: 00592 case UncompressedVideoFrame::ColorSpaceRGB32: 00593 type = Frame::RGB_VOP; 00594 break; 00595 case UncompressedVideoFrame::ColorSpaceYV12: // fall through 00596 case UncompressedVideoFrame::ColorSpaceI420: 00597 type = Frame::YUV_VOP; 00598 break; 00599 default: 00600 dprintf_err("MP4Decoder::close: Unknown colorspace\n"); 00601 exit(-1); 00602 } 00603 UncompressedVideoFrame * decFrame = new UncompressedVideoFrame(type, muiWidth, muiHeight); 00604 decFrame->setAU(pAU); 00605 dprintf_full("MP4Decoder::close(): created UncompressedVideoFrame with type=%d, width=%d, height=%d (ausize=%d)\n", type, muiWidth, muiHeight, decFrame->getAU()->size); 00606 dprintf_full("MP4Decoder::close(): frametype = %d , type = %d\n", decFrame->getType(), type); 00607 00608 #ifdef WINCE 00609 decFrame->setAUy(y); 00610 decFrame->setAUu(u); 00611 decFrame->setAUv(v); 00612 #endif 00613 00614 decFrame->setMediaTimeScale(es->getMediaTimeScale()); 00615 decFrame->setColorSpace(mColorSpace); 00616 decFrame->setColorSpace(mColorSpace); 00617 frmList.push_back(decFrame); 00618 mpOutBuf=NULL;auBuffer[1]=NULL; 00619 } 00620 #endif 00621 } 00622 else { 00623 delete[] mpOutBuf;mpOutBuf=NULL; 00624 if(auBuffer[1]) { 00625 delete auBuffer[1]; 00626 auBuffer[1]=NULL; 00627 } 00628 } 00629 if (initialized) { 00630 DecoderClose((char **) (&mpDecoder)); 00631 initialized = false; 00632 } 00633 00634 return frmList; 00635 }

u32 MP4Decoder::getTranscodingCosts  )  const [virtual]
 

returns adaptation costs (CPU only).

Decoding costs depend directly on the number of out YUV pixels and frames decoded per second (FIXME: codec not supported)

Implements Adaptor.

Definition at line 1504 of file MP4Decoder.cpp.

01505 { 01506 return (u32)(es->getWidth()*es->getHeight()*es->getFPS()); 01507 }

void MP4Decoder::initialize  )  [virtual]
 

Initializes the Decoder.

Is called when the first frame arrives

Implements Adaptor.

Definition at line 190 of file MP4Decoder.cpp.

Referenced by adapt().

00190 { 00191 if (!es) { 00192 initialized = false; 00193 return; 00194 } 00195 if(initialized) 00196 return; 00197 00198 initializeMP4HeaderStruct(); 00199 00200 if(decConfig) { 00201 delete[] decConfig; 00202 decConfig=NULL; 00203 } 00204 if(newDecConfig) { 00205 delete[] newDecConfig; 00206 newDecConfig=NULL; 00207 } 00208 if(mpOutBuf) { 00209 delete[] mpOutBuf; 00210 mpOutBuf=NULL; 00211 } 00212 if(auBuffer[0]) { 00213 delete auBuffer[0]; 00214 auBuffer[0]=NULL; 00215 } 00216 if(auBuffer[1]) { 00217 delete auBuffer[1]; 00218 auBuffer[1]=NULL; 00219 } 00220 if (mpDecoder) { 00221 DecoderClose((char **) (&mpDecoder)); 00222 mpDecoder=NULL; 00223 } 00224 initialized = true; 00225 //has to keep the old value for switching 00226 if (!enableSwitching) { 00227 muiWidth = 0; 00228 muiHeight = 0; 00229 muiLastFrameStart = 0; 00230 muiLastFrameEnd = 0; 00231 } 00232 muiFrameNumber = 0; 00233 00234 decConfig=NULL; 00235 00236 decConfigSize=0; 00237 newDecConfig=NULL; 00238 00239 // muiLastFrameEnd = pESInfo->getHeaders((u8 *) mpBuffer); 00240 00241 muiLastFrameEnd = es->getHeaders(&decConfig); 00242 decConfigSize=muiLastFrameEnd; 00243 memcpy(mpBuffer,decConfig,muiLastFrameEnd); 00244 00245 00246 dprintf_full("MP4Decoder::initialize() %s\r\n",es->getEncodedDecoderConfig()); 00247 00248 #if VITOOKI_DEBUG_LEVEL >= 2 00249 dprintf_full("MP4Decoder::initialize mpBuffer:: "); 00250 for (uint iiii = 0; iiii < muiLastFrameEnd; iiii++) 00251 printf("%02x ", (u8)mpBuffer[iiii]); 00252 dprintf("\r\n"); 00253 #endif 00254 00255 if (muiLastFrameEnd == 0) { 00256 dprintf_err("MP4Decoder::initialize: failed to get header for ESInfo object\n"); 00257 } 00258 initializeParser((u8 *) mpBuffer, muiLastFrameEnd); 00259 if (!parseVOSHeader()) 00260 dprintf_small("No VOS Header found\n"); 00261 if (!parseVOHeader()) 00262 dprintf_small("No VO Header found\n"); 00263 if (!parseUserData()) 00264 dprintf_small("No UserData found\n"); 00265 if (!parseVideoObjectHeader()) 00266 dprintf_small("No VideoObject Header found\n"); 00267 if (!parseVOLHeader()) 00268 dprintf_small("No VOL Header found\n"); 00269 00270 //on switching, ignore the arriving size, but scale to the very first ES 00271 // if (!enableSwitching || muiWidth == 0) { // only set for first time 00272 if (1==1) { 00273 if(es->getCodecID() == CODEC_ID_MPEG4) { 00274 muiWidth = mp4Header.video_object_layer_width; 00275 muiHeight = mp4Header.video_object_layer_height; 00276 00277 #ifdef WINCE 00278 XvidSetHeight(muiHeight); 00279 XvidSetWidth(muiWidth); 00280 #endif 00281 00282 if(es->getAspectRatio() <= 0.0) 00283 es->setAspectRatio((float)muiWidth/muiHeight); 00284 } 00285 00286 if(muiWidth <=0 || muiHeight <= 0) { 00287 muiWidth = es->getWidth(); 00288 muiHeight = es->getHeight(); 00289 } 00290 } else { 00291 dprintf_full("MP4Decoder::initialize: stream switching: upscale %ix%i --> %ix%i\n", 00292 es->getWidth(),es->getHeight(),muiWidth, muiHeight); 00293 } 00294 00295 dprintf_small("MP4Decoder::initialize: DecoderInit to codec %s (id %i) size %ix%i\n", 00296 es->getCodecID() == CODEC_ID_MPEG4?"MPEG4":"OTHER",es->getCodecID(), muiWidth, muiHeight); 00297 int ret = DecoderInit((char **) (&mpDecoder), es->getCodecID(), muiWidth, muiHeight); 00298 00299 if ((ret != ERR_OK) || (mpDecoder == NULL)) { 00300 dprintf_err("MP4Decoder::initialize: Error creating decoder handle (ret=%d)\n",ret); 00301 exit(-1); 00302 } else { 00303 dprintf_small("MP4Decoder::initialize: ok, Decoder set to size %ix%i\n", muiWidth, muiHeight); 00304 //FIXME: hmm... should this be done after streamSwitching and upscale? 00305 es->setHeight(muiHeight); 00306 es->setWidth(muiWidth); 00307 dprintf_full("Mp4Decoder::init Aspect Info %i height %i width %i\n", 00308 this->mp4Header.aspectRatio.aspect_ratio_info, 00309 this->mp4Header.aspectRatio.par_height, 00310 this->mp4Header.aspectRatio.par_width); 00311 if (mp4Header.vop_time_increment_resolution > 0) { 00312 if (mp4Header.vop_time_increment_resolution < 61) { 00313 // treat as frame rate 00314 // most codecs use it as one 00315 u32 ti = es->getMediaTimeScale() / mp4Header.vop_time_increment_resolution; 00316 if(ti > 0) 00317 es->setVOPTimeIncrement(ti); 00318 } 00319 else if ((es->getMediaTimeScale() > mp4Header.vop_time_increment_resolution) && 00320 ((es->getMediaTimeScale() / mp4Header.vop_time_increment_resolution) < 61)) 00321 es->setVOPTimeIncrement(mp4Header.vop_time_increment_resolution); 00322 } 00323 00324 // Process ONLY colorspaces defined in MP4Decoder.hpp 00325 switch (mColorSpace) { 00326 case UncompressedVideoFrame::ColorSpaceGRAY8: 00327 mFrameSize = sizeof(u8) * muiWidth * muiHeight; 00328 break; 00329 case UncompressedVideoFrame::ColorSpaceRGB565: 00330 mFrameSize = sizeof(u8) * muiWidth * muiHeight * 2; 00331 break; 00332 case UncompressedVideoFrame::ColorSpaceRGB24: 00333 mFrameSize = sizeof(u8) * muiWidth * muiHeight * 3; 00334 break; 00335 case UncompressedVideoFrame::ColorSpaceRGB32: 00336 mFrameSize = sizeof(u8) * muiWidth * muiHeight * 4; 00337 break; 00338 case UncompressedVideoFrame::ColorSpaceYV12: // fall through 00339 case UncompressedVideoFrame::ColorSpaceI420: 00340 mFrameSize = sizeof(u8) * muiWidth * muiHeight * 3 / 2; 00341 break; 00342 default: 00343 dprintf_err("MP4Decoder::initialize: Unknown colorspace\n"); 00344 exit(-1); 00345 } 00346 00347 dprintf_full("MP4Decoder::initialize: Esinfo %llu BufferSize %i W %i H %i\n", 00348 es->getStreamId(), es->getBufferSize(), muiWidth, muiHeight); 00349 } 00350 }

ffmpegColorSpace MP4Decoder::mapToFFMPEGColorspace UncompressedVideoFrame::ColorSpace  colorSpace  )  [static]
 

Mapping function between MP4Decoders colorspace (defined in UncompressedVideoFrame::ColorSpace) and FFMPEG codec colorspace.

See also:
UncompressedVideoFrame::ColorSpace

mapToXVIDColorspace

Definition at line 1253 of file MP4Decoder.cpp.

References UncompressedVideoFrame::ColorSpace.

01253 { 01254 ffmpegColorSpace ret = FFMPEGColorSpaceUnknown; 01255 01256 switch (colorSpace) { 01257 case UncompressedVideoFrame::ColorSpaceYV12: 01258 ret = FFMPEGColorSpaceYV12; 01259 break; 01260 case UncompressedVideoFrame::ColorSpaceRGB24: 01261 ret = FFMPEGColorSpaceRGB24; 01262 break; 01263 case UncompressedVideoFrame::ColorSpaceI420: 01264 ret = FFMPEGColorSpaceI420; 01265 break; 01266 case UncompressedVideoFrame::ColorSpaceRGB32: 01267 ret = FFMPEGColorSpaceRGB32; 01268 break; 01269 case UncompressedVideoFrame::ColorSpaceRGB565: 01270 ret = FFMPEGColorSpaceRGB565; 01271 break; 01272 case UncompressedVideoFrame::ColorSpaceGRAY8: 01273 ret = FFMPEGColorSpaceGRAY8; 01274 break; 01275 default: 01276 ret = FFMPEGColorSpaceUnknown; 01277 break; 01278 } 01279 01280 return ret; 01281 }

xvidColorSpace MP4Decoder::mapToXVIDColorspace UncompressedVideoFrame::ColorSpace  colorSpace  )  [static]
 

Mapping function between MP4Decoders colorspace (defined in UncompressedVideoFrame::ColorSpace) and XviD codec colorspace.

See also:
UncompressedVideoFrame::ColorSpace

mapToFFMPEGColorspace

Definition at line 1227 of file MP4Decoder.cpp.

References UncompressedVideoFrame::ColorSpace.

01227 { 01228 xvidColorSpace ret = XVIDColorSpaceUnknown; 01229 01230 switch (colorSpace) { 01231 case UncompressedVideoFrame::ColorSpaceYV12: 01232 ret = XVIDColorSpaceYV12; 01233 break; 01234 case UncompressedVideoFrame::ColorSpaceRGB24: 01235 ret = XVIDColorSpaceRGB24; 01236 break; 01237 case UncompressedVideoFrame::ColorSpaceI420: 01238 ret = XVIDColorSpaceI420; 01239 break; 01240 case UncompressedVideoFrame::ColorSpaceRGB32: 01241 ret = XVIDColorSpaceRGB32; 01242 break; 01243 default: 01244 ret = XVIDColorSpaceUnknown; 01245 break; 01246 } 01247 01248 return ret; 01249 }

void MP4Decoder::setCoderType eCoderType  coderType = XVID  ) 
 

Codec selection.

Parameters:
coderType Type of codec to use. Defaults to XviD
See also:
meCoderType
Definition at line 1158 of file MP4Decoder.cpp.
01158 { 01159 meCoder = coderType; 01160 }


The documentation for this class was generated from the following files: