Changeset 960
- Timestamp:
- 10/10/08 20:16:08 (1 month ago)
- Files:
-
- branches/perian-1.1/Codecprintf.c (modified) (3 diffs)
- branches/perian-1.1/Codecprintf.h (modified) (1 diff)
- branches/perian-1.1/CommonUtils.c (modified) (1 diff)
- branches/perian-1.1/FFusionCodec.c (modified) (12 diffs)
- branches/perian-1.1/bitstream_info.c (modified) (6 diffs)
- branches/perian-1.1/bitstream_info.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/perian-1.1/Codecprintf.c
r887 r960 13 13 #include "log.h" 14 14 15 #ifdef DEBUG_BUILD16 15 #define CODEC_HEADER "Perian Codec: " 17 #define FILELOG18 16 19 17 static int Codecvprintf(FILE *fileLog, const char *format, va_list va, int print_header) 20 18 { 21 int ret ;19 int ret = 0; 22 20 23 #ifdef FILELOG24 21 if(fileLog) 25 22 { … … 31 28 else 32 29 { 33 # endif30 #ifdef DEBUG_BUILD 34 31 if(print_header) 35 32 printf(CODEC_HEADER); 36 33 37 34 ret = vprintf(format, va); 38 # ifdef FILELOG35 #endif 39 36 } 40 #endif41 37 42 38 return ret; … … 68 64 } 69 65 70 #else71 #define Codecvprintf(file, fmt, va, print_header) /**/72 #endif73 74 66 void FFMpegCodecprintf(void* ptr, int level, const char* fmt, va_list vl) 75 67 { branches/perian-1.1/Codecprintf.h
r887 r960 12 12 #endif 13 13 14 #ifdef DEBUG_BUILD15 14 int Codecprintf(FILE *, const char *format, ...); 16 15 void FourCCprintf(char *string, FourCharCode a); 17 16 const char *FourCCString(FourCharCode c); 18 #else19 #define Codecprintf(file, fmt, ...) /**/20 #define FourCCprintf(string,a) /**/21 #endif22 17 23 18 void FFMpegCodecprintf(void* ptr, int level, const char* fmt, va_list vl); branches/perian-1.1/CommonUtils.c
r959 r960 341 341 enabled = findNameInList(myProcessName, defaultFrameDroppingWhiteList, count); 342 342 } 343 //Codecprintf(NULL, "Frame Dropping enabled is %d for %s\n", enabled, CFStringGetCStringPtr(myProcessName, kCFStringEncodingMacRoman));344 343 CFRelease(myProcessName); 345 344 CFRelease(processInformation); branches/perian-1.1/FFusionCodec.c
r956 r960 266 266 if (!glob->fileLog || glob->decode.lastFrame == 0) return; 267 267 268 Codecprintf(glob->fileLog, " Type\t| BeginBand\t| DecodeBand\t| DrawBand\t| dropped before decode\t| dropped before draw\n");268 Codecprintf(glob->fileLog, "%p frame drop stats\nType\t| BeginBand\t| DecodeBand\t| DrawBand\t| dropped before decode\t| dropped before draw\n", glob); 269 269 270 270 for (i = 0; i < 4; i++) { … … 319 319 else 320 320 { 321 CFStringRef pathToLogFile = CFPreferencesCopyAppValue(CFSTR("DebugLogFile"), CFSTR("org.perian.Perian")); 322 char path[PATH_MAX]; 321 323 SetComponentInstanceStorage(self, (Handle)glob); 322 324 323 325 glob->self = self; 324 326 glob->target = self; … … 331 333 glob->data.frames = NULL; 332 334 glob->begin.parser = NULL; 333 if (getenv("PerianDebugLogging")) glob->fileLog = fopen("/tmp/perian.log", "a"); 334 else glob->fileLog = NULL; 335 if (pathToLogFile) { 336 CFStringGetCString(pathToLogFile, path, PATH_MAX, kCFStringEncodingUTF8); 337 CFRelease(pathToLogFile); 338 glob->fileLog = fopen(path, "a"); 339 } 335 340 glob->shouldUseReturnedFrame = 0; 336 341 337 342 // c = FindNextComponent(c, &cd); 338 343 … … 485 490 pascal ComponentResult FFusionCodecInitialize(FFusionGlobals glob, ImageSubCodecDecompressCapabilities *cap) 486 491 { 487 Boolean doExperimentalFlags = getenv("PerianExperimentalQTFlags") != NULL;492 Boolean doExperimentalFlags = CFPreferencesGetAppBooleanValue(CFSTR("ExperimentalQTFlags"), CFSTR("org.perian.Perian"), NULL); 488 493 489 494 // Secifies the size of the ImageSubCodecDecompressRecord structure … … 537 542 538 543 FFusionDebugPrint("%p Preflight called.\n", glob); 544 FFusionDebugPrint("%p Frame dropping is %senabled\n", glob, not(IsFrameDroppingEnabled())); 539 545 540 546 if (!glob->avCodec) … … 775 781 if(glob->avContext->extradata_size != 0 && glob->begin.parser != NULL) 776 782 ffusionParseExtraData(glob->begin.parser, glob->avContext->extradata, glob->avContext->extradata_size); 783 784 if (glob->fileLog) 785 ffusionLogDebugInfo(glob->begin.parser, glob->fileLog); 777 786 778 787 // XXX: at the moment ffmpeg can't handle interlaced H.264 right … … 1175 1184 /* If this is a key frame or the P frame before us is after the last frame (skip ahead), or we are before the last decoded frame (skip back) * 1176 1185 * then we are in a whole new GOP */ 1177 FFusionDebugPrint("%p - in a new GOP.\n", glob);1178 1186 avcodec_flush_buffers(glob->avContext); 1179 1187 } … … 1236 1244 avcodec_get_frame_defaults(&tempFrame); 1237 1245 err = FFusionDecompress(glob, glob->avContext, dataPtr, dataProc, myDrp->width, myDrp->height, &tempFrame, dataSize); 1238 1246 1239 1247 if (glob->packedType == PACKED_QUICKTIME_KNOWS_ORDER) { 1240 1248 myDrp->buffer = &glob->buffers[glob->lastAllocatedBuffer]; … … 1243 1251 myDrp->buffer->returnedFrame = tempFrame; 1244 1252 myDrp->decoded = true; 1253 glob->decode.lastFrame = myDrp->frameNumber; 1245 1254 return err; 1246 1255 } … … 1259 1268 FFusionDataMarkRead(&(glob->data), frameData); 1260 1269 1261 FFusionDebugPrint("%p DecodeBand decoded #%d.\n", glob, glob->decode.lastFrame);1262 1263 1270 return err; 1264 1271 } … … 1304 1311 { 1305 1312 picture = myDrp->buffer->frame; 1306 FFusionDebugPrint("%p DrawBand #%d. found %d\n", glob, myDrp->frameNumber, myDrp->buffer->frameNumber);1307 1313 } 1308 1314 else … … 1738 1744 long availableData = dataProc ? codecMinimumDataSize : kInfiniteDataSize; 1739 1745 1740 FFusionDebugPrint("%p Decompress on frame #%d (%d bytes).\n", glob, glob->decode.lastFrame, length);1746 FFusionDebugPrint("%p Decompress %d bytes.\n", glob, length); 1741 1747 picture->data[0] = 0; 1742 1748 branches/perian-1.1/bitstream_info.c
r947 r960 251 251 int prevPts; 252 252 253 int profile_idc; 254 int level_idc; 255 253 256 int poc_type; 254 257 int log2_max_frame_num; … … 266 269 267 270 int chroma_format_idc; 271 272 int gaps_in_frame_num_value_allowed_flag; 268 273 }H264ParserContext; 269 274 … … 334 339 { 335 340 GetBitContext getbit, *gb = &getbit; 336 int profile_idc;337 341 338 342 init_get_bits(gb, buf, 8 * buf_size); 339 profile_idc= get_bits(gb, 8);343 context->profile_idc= get_bits(gb, 8); 340 344 get_bits1(gb); //constraint_set0_flag 341 345 get_bits1(gb); //constraint_set1_flag … … 343 347 get_bits1(gb); //constraint_set3_flag 344 348 get_bits(gb, 4); //reserved 345 get_bits(gb, 8); //level_idc349 context->level_idc = get_bits(gb, 8); //level_idc 346 350 get_ue_golomb(gb); //seq_parameter_set_id 347 if( profile_idc >= 100)351 if(context->profile_idc >= 100) 348 352 { 349 353 context->chroma_format_idc = get_ue_golomb(gb); … … 373 377 } 374 378 get_ue_golomb(gb); //num_ref_frames 375 get_bits1(gb); //gaps_in_frame_num_value_allowed_flag379 context->gaps_in_frame_num_value_allowed_flag = get_bits1(gb); //gaps_in_frame_num_value_allowed_flag 376 380 get_ue_golomb(gb); //pic_width_in_mbs_minus1 377 381 get_ue_golomb(gb); //pic_height_in_map_units_minus1 … … 862 866 } 863 867 868 void ffusionLogDebugInfo(FFusionParserContext *parser, FILE *log) 869 { 870 if (parser) { 871 if (parser->parserStructure == &ffusionH264Parser) { 872 H264ParserContext *h264parser = parser->internalContext; 873 874 Codecprintf(log, "H.264 format: profile %d level %d\n\tis_avc %d\n\tframe_mbs_only %d\n\tchroma_format_idc %d\n\tframe_num_gaps %d\n", 875 h264parser->profile_idc, h264parser->level_idc, h264parser->is_avc, h264parser->frame_mbs_only_flag, h264parser->chroma_format_idc, h264parser->gaps_in_frame_num_value_allowed_flag); 876 } 877 } 878 } 879 864 880 int ffusionIsParsedVideoDecodable(FFusionParserContext *parser) 865 881 { branches/perian-1.1/bitstream_info.h
r797 r960 43 43 int ffusionParseExtraData(FFusionParserContext *parser, const uint8_t *buf, int buf_size); 44 44 int ffusionParse(FFusionParserContext *parser, const uint8_t *buf, int buf_size, int *out_buf_size, int *type, int *skippable); 45 void ffusionLogDebugInfo(FFusionParserContext *parser, FILE *log); 45 46 int ffusionIsParsedVideoDecodable(FFusionParserContext *parser); 46 47
