Mercurial > libavformat.hg
comparison nut.c @ 478:ac85aafd0971 libavformat
file id string
max short startcode distance
author | michael |
---|---|
date | Mon, 14 Jun 2004 21:30:36 +0000 |
parents | 60f897e8dd2d |
children | 0a997108f384 |
comparison
equal
deleted
inserted
replaced
477:3fc285cdb791 | 478:ac85aafd0971 |
---|---|
47 #define STREAM_STARTCODE (0x11405BF2F9DBULL + (((uint64_t)('N'<<8) + 'S')<<48)) | 47 #define STREAM_STARTCODE (0x11405BF2F9DBULL + (((uint64_t)('N'<<8) + 'S')<<48)) |
48 #define KEYFRAME_STARTCODE (0xE4ADEECA4569ULL + (((uint64_t)('N'<<8) + 'K')<<48)) | 48 #define KEYFRAME_STARTCODE (0xE4ADEECA4569ULL + (((uint64_t)('N'<<8) + 'K')<<48)) |
49 #define INDEX_STARTCODE (0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48)) | 49 #define INDEX_STARTCODE (0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48)) |
50 #define INFO_STARTCODE (0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)) | 50 #define INFO_STARTCODE (0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)) |
51 | 51 |
52 #define ID_STRING "nut/multimedia container\0" | |
53 | |
52 #define MAX_DISTANCE (1024*16-1) | 54 #define MAX_DISTANCE (1024*16-1) |
53 #define MAX_SHORT_DISTANCE (1024*4-1) | 55 #define MAX_SHORT_DISTANCE (1024*4-1) |
54 | 56 |
55 #define FLAG_DATA_SIZE 1 | 57 #define FLAG_DATA_SIZE 1 |
56 #define FLAG_KEY_FRAME 2 | 58 #define FLAG_KEY_FRAME 2 |
82 FrameCode frame_code[256]; | 84 FrameCode frame_code[256]; |
83 int stream_count; | 85 int stream_count; |
84 uint64_t next_startcode; ///< stores the next startcode if it has alraedy been parsed but the stream isnt seekable | 86 uint64_t next_startcode; ///< stores the next startcode if it has alraedy been parsed but the stream isnt seekable |
85 StreamContext *stream; | 87 StreamContext *stream; |
86 int max_distance; | 88 int max_distance; |
89 int max_short_distance; | |
87 int rate_num; | 90 int rate_num; |
88 int rate_den; | 91 int rate_den; |
89 int short_startcode; | 92 int short_startcode; |
90 } NUTContext; | 93 } NUTContext; |
91 | 94 |
508 | 511 |
509 nut->avf= s; | 512 nut->avf= s; |
510 | 513 |
511 nut->stream = | 514 nut->stream = |
512 av_mallocz(sizeof(StreamContext)*s->nb_streams); | 515 av_mallocz(sizeof(StreamContext)*s->nb_streams); |
516 | |
517 | |
518 put_buffer(bc, ID_STRING, strlen(ID_STRING)); | |
519 put_byte(bc, 0); | |
520 nut->packet_start[2]= url_ftell(bc); | |
513 | 521 |
514 /* main header */ | 522 /* main header */ |
515 put_be64(bc, MAIN_STARTCODE); | 523 put_be64(bc, MAIN_STARTCODE); |
516 put_packetheader(nut, bc, 120+5*256, 1); | 524 put_packetheader(nut, bc, 120+5*256, 1); |
517 put_v(bc, 2); /* version */ | 525 put_v(bc, 2); /* version */ |
518 put_v(bc, s->nb_streams); | 526 put_v(bc, s->nb_streams); |
519 put_v(bc, MAX_DISTANCE); | 527 put_v(bc, MAX_DISTANCE); |
528 put_v(bc, MAX_SHORT_DISTANCE); | |
520 | 529 |
521 put_v(bc, nut->rate_num=1); | 530 put_v(bc, nut->rate_num=1); |
522 put_v(bc, nut->rate_den=2); | 531 put_v(bc, nut->rate_den=2); |
523 put_v(bc, nut->short_startcode=0x4EFE79); | 532 put_v(bc, nut->short_startcode=0x4EFE79); |
524 | 533 |
867 return -1; | 876 return -1; |
868 } | 877 } |
869 | 878 |
870 nut->stream_count = get_v(bc); | 879 nut->stream_count = get_v(bc); |
871 nut->max_distance = get_v(bc); | 880 nut->max_distance = get_v(bc); |
881 nut->max_short_distance = get_v(bc); | |
872 nut->rate_num= get_v(bc); | 882 nut->rate_num= get_v(bc); |
873 nut->rate_den= get_v(bc); | 883 nut->rate_den= get_v(bc); |
874 nut->short_startcode= get_v(bc); | 884 nut->short_startcode= get_v(bc); |
875 if(nut->short_startcode>>16 != 'N'){ | 885 if(nut->short_startcode>>16 != 'N'){ |
876 av_log(s, AV_LOG_ERROR, "invalid short startcode %X\n", nut->short_startcode); | 886 av_log(s, AV_LOG_ERROR, "invalid short startcode %X\n", nut->short_startcode); |