00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <stdio.h>
00030 #include <string.h>
00031
00032 #include "element.h"
00033 #include "mpg_common.h"
00034 #include "pes.h"
00035
00036 #include "mythlogging.h"
00037
00038 unsigned int slots [4] = {12, 144, 0, 0};
00039 unsigned int bitrates[3][16] =
00040 {{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0},
00041 {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,0},
00042 {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}};
00043
00044 uint32_t freq[4] = {441, 480, 320, 0};
00045 static uint64_t samples[4] = { 384, 1152, 1152, 1536};
00046 const char *frames[3] = {"I-Frame","P-Frame","B-Frame"};
00047
00048 unsigned int ac3_bitrates[32] =
00049 {32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640,
00050 0,0,0,0,0,0,0,0,0,0,0,0,0};
00051 static uint8_t ac3half[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3};
00052 uint32_t ac3_freq[4] = {480, 441, 320, 0};
00053
00054 #define DEBUG 1
00055
00056 uint64_t add_pts_audio(uint64_t pts, audio_frame_t *aframe, uint64_t frames)
00057 {
00058 int64_t newpts=0;
00059
00060 newpts = (pts + (frames *samples [3-aframe->layer] * 27000000ULL)
00061 / aframe->frequency);
00062 return newpts>0 ? newpts%MAX_PTS2: MAX_PTS2+newpts;
00063 }
00064
00065 void fix_audio_count(uint64_t *acount, audio_frame_t *aframe, uint64_t origpts, uint64_t pts)
00066 {
00067 int64_t diff;
00068 uint64_t di;
00069 int c=0;
00070
00071 di = (samples [3-aframe->layer] * 27000000ULL);
00072 diff = ptsdiff(origpts,pts);
00073 c=(aframe->frequency * diff+di/2)/di;
00074 if (c) LOG(VB_GENERAL, LOG_INFO, "fix audio frames %d", c);
00075 *acount += c;
00076 }
00077
00078
00079 uint64_t next_ptsdts_video(uint64_t *pts, sequence_t *s, uint64_t fcount, uint64_t gcount)
00080 {
00081 int64_t newdts = 0, newpts = 0;
00082 int64_t fnum = s->current_tmpref - gcount + fcount;
00083
00084
00085 if ( s->pulldown == NOPULLDOWN ) {
00086 newdts = ( (fcount-1) * SEC_PER + *pts);
00087 newpts = ((fnum ) * SEC_PER + *pts);
00088 } else {
00089 uint64_t extra_time = 0;
00090 #if 0
00091 LOG(VB_GENERAL, LOG_INFO, "pulldown %d %d",
00092 (int)fcount-1, fnum-1);
00093 #endif
00094
00095 if ( s->pulldown == PULLDOWN32)
00096 extra_time = SEC_PER;
00097 else
00098 extra_time = 3*SEC_PER/2;
00099
00100 newdts = (fcount - 1) * 5ULL * SEC_PER / 4ULL +
00101 ((fcount - 1)%2)*extra_time +
00102 *pts;
00103
00104 if ((s->pulldown == PULLDOWN23) && (fcount-1))
00105 newdts -= SEC_PER/2;
00106
00107 newpts = SEC_PER +
00108 (fnum -1) * 5ULL * SEC_PER / 4ULL +
00109 ((fnum - 1)%2)*extra_time +
00110 *pts;
00111
00112 }
00113
00114
00115 *pts = newpts >= 0 ? newpts%MAX_PTS2: MAX_PTS2+newpts;
00116 return newdts >= 0 ? newdts%MAX_PTS2: MAX_PTS2+newdts;
00117 }
00118
00119 void fix_video_count(sequence_t *s, uint64_t *frame, uint64_t origpts, uint64_t pts,
00120 uint64_t origdts, uint64_t dts)
00121 {
00122 int64_t pdiff = 0;
00123 int64_t ddiff = 0;
00124 int64_t pframe = 0;
00125 int64_t dframe = 0;
00126 int psig=0;
00127 int dsig=0;
00128 int64_t fr=0;
00129
00130 pdiff = ptsdiff(origpts,pts);
00131 ddiff = ptsdiff(origdts,dts);
00132 psig = pdiff > 0;
00133 dsig = ddiff > 0;
00134 if (!psig) pdiff = -pdiff;
00135 if (!dsig) ddiff = -ddiff;
00136
00137 if ( s->pulldown == NOPULLDOWN ) {
00138 dframe = (ddiff+SEC_PER/2ULL) / SEC_PER;
00139 pframe = (pdiff+SEC_PER/2ULL) / SEC_PER;
00140 } else {
00141 dframe = (4ULL*ddiff/5ULL+SEC_PER/2ULL) / SEC_PER;
00142 pframe = (4ULL*pdiff/5ULL+SEC_PER/2ULL) / SEC_PER;
00143 }
00144
00145 if (!psig) fr = -(int)pframe;
00146 else fr = (int)pframe;
00147 if (!dsig) fr -= (int)dframe;
00148 else fr += (int)dframe;
00149 *frame = *frame + fr/2;
00150 if (fr/2) LOG(VB_GENERAL, LOG_INFO, "fixed video frame %d", (int)fr/2);
00151 }
00152
00153
00154 void pts2time(uint64_t pts, uint8_t *buf, int len)
00155 {
00156 uint8_t h,m,s;
00157 int c = 0;
00158
00159 pts = (pts/300)%MAX_PTS;
00160 h = (uint8_t)(pts/90000)/3600;
00161 m = (uint8_t)((pts/90000)%3600)/60;
00162 s = (uint8_t)((pts/90000)%3600)%60;
00163
00164 while (c+7 < len){
00165 if (buf[c] == 0x00 && buf[c+1] == 0x00 && buf[c+2] == 0x01 &&
00166 buf[c+3] == GROUP_START_CODE && (buf[c+5] & 0x08)){
00167 buf[c+4] &= ~(0x7F);
00168 buf[c+4] |= (h & 0x1F) << 2;
00169 buf[c+4] |= (m & 0x30) >> 4;
00170
00171 buf[c+5] &= ~(0xF7);
00172 buf[c+5] |= (m & 0x0F) << 4;
00173 buf[c+5] |= (s & 0x38) >> 3;
00174
00175 buf[c+6] &= ~(0xE0);
00176 buf[c+6] |= (s & 0x07) << 5;
00177
00178
00179 #if 0
00180 c+=4;
00181 LOG(VB_GENERAL, LOG_INFO, "fixed time");
00182 LOG(VB_GENERAL, LOG_INFO, "%02d:%02d:%02d",
00183 (int)((buf[c]>>2)& 0x1F),
00184 (int)(((buf[c]<<4)& 0x30)|((buf[c+1]>>4)& 0x0F)),
00185 (int)(((buf[c+1]<<3)& 0x38)|((buf[c+2]>>5)& 0x07)));
00186 #endif
00187 c = len;
00188
00189
00190 } else c++;
00191 }
00192
00193 }
00194
00195
00196 int get_video_info(ringbuffer *rbuf, sequence_t *s, int off, int le)
00197 {
00198 uint8_t buf[150];
00199 uint8_t *headr;
00200 int sw,i;
00201 int form = -1;
00202 int c = 0;
00203 int re = 0;
00204
00205
00206 s->set = 0;
00207 s->ext_set = 0;
00208 s->pulldown_set = 0;
00209 if ((re = ring_find_mpg_header(rbuf, SEQUENCE_HDR_CODE, off, le)) < 0)
00210 return re;
00211 headr = buf+4;
00212 if (ring_peek(rbuf, buf, 150, off) < 0) return -2;
00213
00214 s->h_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4);
00215 s->v_size = ((headr[1] &0x0F) << 8) | (headr[2]);
00216
00217 sw = (int)((headr[3]&0xF0) >> 4) ;
00218
00219 if (DEBUG){
00220 switch( sw ){
00221 case 1:
00222 LOG(VB_GENERAL, LOG_INFO, "Video: aspect ratio: 1:1");
00223 s->aspect_ratio = 100;
00224 break;
00225 case 2:
00226 LOG(VB_GENERAL, LOG_INFO, "Video: aspect ratio: 4:3");
00227 s->aspect_ratio = 133;
00228 break;
00229 case 3:
00230 LOG(VB_GENERAL, LOG_INFO, "Video: aspect ratio: 16:9");
00231 s->aspect_ratio = 177;
00232 break;
00233 case 4:
00234 LOG(VB_GENERAL, LOG_INFO,
00235 "Video: aspect ratio: 2.21:1");
00236 s->aspect_ratio = 221;
00237 break;
00238
00239 case 5 ... 15:
00240 LOG(VB_GENERAL, LOG_INFO,
00241 "Video: aspect ratio: reserved");
00242 s->aspect_ratio = 0;
00243 break;
00244
00245 default:
00246 s->aspect_ratio = 0;
00247 return -3;
00248 }
00249 }
00250
00251 if (DEBUG)
00252 LOG(VB_GENERAL, LOG_DEBUG, " size = %dx%d",
00253 s->h_size, s->v_size);
00254
00255 sw = (int)(headr[3]&0x0F);
00256
00257 switch ( sw ) {
00258 case 1:
00259 s->frame_rate = 23976;
00260 form = -1;
00261 break;
00262 case 2:
00263 s->frame_rate = 24000;
00264 form = -1;
00265 break;
00266 case 3:
00267 s->frame_rate = 25000;
00268 form = VIDEO_PAL;
00269 break;
00270 case 4:
00271 s->frame_rate = 29970;
00272 form = VIDEO_NTSC;
00273 break;
00274 case 5:
00275 s->frame_rate = 30000;
00276 form = VIDEO_NTSC;
00277 break;
00278 case 6:
00279 s->frame_rate = 50000;
00280 form = VIDEO_PAL;
00281 break;
00282 case 7:
00283 s->frame_rate = 60000;
00284 form = VIDEO_NTSC;
00285 break;
00286 }
00287 if (DEBUG)
00288 LOG(VB_GENERAL, LOG_DEBUG, " frame rate: %2.3f fps",
00289 s->frame_rate/1000.0);
00290
00291 s->bit_rate = (((headr[4] << 10) & 0x0003FC00UL)
00292 | ((headr[5] << 2) & 0x000003FCUL) |
00293 (((headr[6] & 0xC0) >> 6) & 0x00000003UL));
00294
00295 if (DEBUG)
00296 LOG(VB_GENERAL, LOG_DEBUG, " bit rate: %.2f Mbit/s",
00297 400*(s->bit_rate)/1000000.0);
00298
00299 s->video_format = form;
00300
00301
00302
00303 s->vbv_buffer_size = (( headr[7] & 0xF8) >> 3 ) | (( headr[6] & 0x1F )<< 5);
00304 s->flags = ( headr[7] & 0x06);
00305 if (DEBUG)
00306 LOG(VB_GENERAL, LOG_DEBUG, " vbvbuffer %d",
00307 16*1024*(s->vbv_buffer_size));
00308
00309 c += 8;
00310 if ( !(s->flags & INTRAQ_FLAG) )
00311 s->flags = ( headr[7] & 0x07);
00312 else {
00313 s->flags |= headr[c+63] & 0x01;
00314 memset(s->intra_quant, 0, 64);
00315 for (i=0;i<64;i++)
00316 s->intra_quant[i] |= (headr[c+i] >> 1) |
00317 (( headr[c-1+i] & 0x01) << 7);
00318
00319 c += 64;
00320 }
00321 if (s->flags & NONINTRAQ_FLAG){
00322 memcpy(s->non_intra_quant, headr+c, 64);
00323 c += 64;
00324 }
00325 s->set=1;
00326
00327 return c;
00328 }
00329
00330 int find_audio_sync(ringbuffer *rbuf, uint8_t *buf, int off, int type, int le)
00331 {
00332 int found = 0;
00333 int c=0;
00334 int l;
00335 uint8_t b1,b2,m2;
00336 int r=0;
00337
00338 memset(buf,0,7);
00339 b1 = 0x00;
00340 b2 = 0x00;
00341 m2 = 0xFF;
00342 switch(type){
00343 case AC3:
00344 b1 = 0x0B;
00345 b2 = 0x77;
00346 l = 6;
00347 break;
00348
00349 case MPEG_AUDIO:
00350 b1 = 0xFF;
00351 b2 = 0xF8;
00352 m2 = 0xF8;
00353 l = 4;
00354 break;
00355
00356 default:
00357 return -1;
00358 }
00359
00360 c = off;
00361 while ( c-off < le){
00362 uint8_t b;
00363 if ((r = mring_peek(rbuf, &b, 1, c)) <0) return -1;
00364 switch(found){
00365
00366 case 0:
00367 if ( b == b1) found = 1;
00368 break;
00369
00370 case 1:
00371 if ( (b&m2) == b2){
00372 if ((r = mring_peek(rbuf, buf, l, c-1)) < -1)
00373 return -2;
00374 return c-1-off;
00375 } else if ( b != b1) found = 0;
00376 }
00377 c++;
00378 }
00379 if (found) return -2;
00380 return -1;
00381 }
00382
00383 int find_audio_s(uint8_t *rbuf, int off, int type, int le)
00384 {
00385 int found = 0;
00386 int c=0;
00387 int l;
00388 uint8_t b1,b2,m2;
00389
00390 b1 = 0x00;
00391 b2 = 0x00;
00392 m2 = 0xFF;
00393 switch(type){
00394 case AC3:
00395 b1 = 0x0B;
00396 b2 = 0x77;
00397 l = 6;
00398 break;
00399
00400 case MPEG_AUDIO:
00401 b1 = 0xFF;
00402 b2 = 0xF8;
00403 m2 = 0xF8;
00404 l = 4;
00405 break;
00406
00407 default:
00408 return -1;
00409 }
00410
00411 c = off;
00412 while ( c < le){
00413 uint8_t b=rbuf[c];
00414 switch(found){
00415 case 0:
00416 if ( b == b1) found = 1;
00417 break;
00418
00419 case 1:
00420 if ( (b&m2) == b2){
00421 return c-1;
00422 } else if ( b != b1) found = 0;
00423 }
00424 c++;
00425 }
00426 if (found) return -2;
00427 return -1;
00428 }
00429
00430 int check_audio_header(ringbuffer *rbuf, audio_frame_t * af, int off, int le,
00431 int type)
00432 {
00433 uint8_t headr[7];
00434 uint8_t frame;
00435 int fr;
00436 int half = 0;
00437 int c=0;
00438
00439 if ( (c = find_audio_sync(rbuf, headr, off, type, le))
00440 != 0 ) {
00441 if (c==-2){
00442 LOG(VB_GENERAL, LOG_ERR, "Incomplete audio header");
00443 return -2;
00444 }
00445 LOG(VB_GENERAL, LOG_ERR, "Error in audio header");
00446 return -1;
00447 }
00448 switch (type){
00449
00450 case MPEG_AUDIO:
00451 if ( af->layer != ((headr[1] & 0x06) >> 1) ){
00452 if ( headr[1] == 0xff){
00453 return -3;
00454 } else {
00455 #ifdef IN_DEBUG
00456 LOG(VB_GENERAL, LOG_ERR, "Wrong audio layer");
00457 #endif
00458 return -1;
00459 }
00460 }
00461 if ( af->bit_rate !=
00462 (bitrates[(3-af->layer)][(headr[2] >> 4 )]*1000)){
00463 #ifdef IN_DEBUG
00464 LOG(VB_GENERAL, LOG_ERR, "Wrong audio bit rate");
00465 #endif
00466 return -1;
00467 }
00468 break;
00469
00470 case AC3:
00471 frame = (headr[4]&0x3F);
00472 if (af->bit_rate != ac3_bitrates[frame>>1]*1000){
00473 #ifdef IN_DEBUG
00474 LOG(VB_GENERAL, LOG_ERR, "Wrong audio bit rate");
00475 #endif
00476 return -1;
00477 }
00478 half = ac3half[headr[5] >> 3];
00479 fr = (headr[4] & 0xc0) >> 6;
00480 if (af->frequency != ((ac3_freq[fr] *100) >> half)){
00481 #ifdef IN_DEBUG
00482 LOG(VB_GENERAL, LOG_ERR, "Wrong audio frequency");
00483 #endif
00484 return -1;
00485 }
00486
00487 break;
00488
00489 }
00490
00491 return 0;
00492 }
00493
00494
00495 int get_audio_info(ringbuffer *rbuf, audio_frame_t *af, int off, int le)
00496 {
00497 int c = 0;
00498 int fr =0;
00499 uint8_t headr[7];
00500
00501 af->set=0;
00502
00503 if ( (c = find_audio_sync(rbuf, headr, off, MPEG_AUDIO,le)) < 0 )
00504 return c;
00505
00506 af->layer = (headr[1] & 0x06) >> 1;
00507
00508 if (DEBUG)
00509 LOG(VB_GENERAL, LOG_DEBUG, "Audiostream: layer: %d",
00510 4-af->layer);
00511
00512
00513 af->bit_rate = bitrates[(3-af->layer)][(headr[2] >> 4 )]*1000;
00514
00515 if (DEBUG){
00516 if (af->bit_rate == 0)
00517 LOG(VB_GENERAL, LOG_DEBUG, " Bit rate: free");
00518 else if (af->bit_rate == 0xf)
00519 LOG(VB_GENERAL, LOG_DEBUG, " BRate: reserved");
00520 else
00521 LOG(VB_GENERAL, LOG_DEBUG, " BRate: %d kb/s",
00522 af->bit_rate/1000);
00523 }
00524
00525 fr = (headr[2] & 0x0c ) >> 2;
00526 af->frequency = freq[fr]*100;
00527
00528 if (DEBUG){
00529 if (af->frequency == 3)
00530 LOG(VB_GENERAL, LOG_DEBUG, " Freq: reserved");
00531 else
00532 LOG(VB_GENERAL, LOG_DEBUG, " Freq: %2.1f kHz",
00533 af->frequency/1000.0);
00534 }
00535 af->off = c;
00536 af->set = 1;
00537
00538 af->frametime = ((samples [3-af->layer] * 27000000ULL) / af->frequency);
00539 af->framesize = af->bit_rate *slots [3-af->layer]/ af->frequency;
00540 LOG(VB_GENERAL, LOG_INFO, " frame size: %d", af->framesize);
00541 printpts(af->frametime);
00542
00543 return c;
00544 }
00545
00546 int get_ac3_info(ringbuffer *rbuf, audio_frame_t *af, int off, int le)
00547 {
00548 int c=0;
00549 uint8_t headr[7];
00550 uint8_t frame;
00551 int half = 0;
00552 int fr;
00553
00554
00555 af->set=0;
00556
00557 if ((c = find_audio_sync(rbuf, headr, off, AC3, le)) < 0 )
00558 return c;
00559
00560 af->off = c;
00561
00562 af->layer = 0;
00563
00564 if (DEBUG)
00565 LOG(VB_GENERAL, LOG_DEBUG, "AC3 stream:");
00566 frame = (headr[4]&0x3F);
00567 af->bit_rate = ac3_bitrates[frame>>1]*1000;
00568 half = ac3half[headr[5] >> 3];
00569 if (DEBUG)
00570 LOG(VB_GENERAL, LOG_DEBUG, " bit rate: %d kb/s",
00571 af->bit_rate/1000);
00572 fr = (headr[4] & 0xc0) >> 6;
00573 af->frequency = (ac3_freq[fr] *100) >> half;
00574
00575 if (DEBUG)
00576 LOG(VB_GENERAL, LOG_DEBUG, " freq: %d Hz", af->frequency);
00577
00578 switch (headr[4] & 0xc0) {
00579 case 0:
00580 af->framesize = 4 * af->bit_rate/1000;
00581 break;
00582
00583 case 0x40:
00584 af->framesize = 2 * (320 * af->bit_rate / 147000 + (frame & 1));
00585 break;
00586
00587 case 0x80:
00588 af->framesize = 6 * af->bit_rate/1000;
00589 break;
00590 }
00591
00592 if (DEBUG)
00593 LOG(VB_GENERAL, LOG_DEBUG, " frame size %d", af->framesize);
00594
00595 af->off = c;
00596 af->set = 1;
00597
00598
00599 af->frametime = 0;
00600
00601 return c;
00602 }
00603
00604
00605 int get_video_ext_info(ringbuffer *rbuf, sequence_t *s, int off, int le)
00606 {
00607 uint8_t *headr;
00608 uint8_t buf[12];
00609 uint8_t ext_id;
00610 int re=0;
00611
00612 if (( re =ring_find_mpg_header(rbuf, EXTENSION_START_CODE, off, le)) < 0){
00613 LOG(VB_GENERAL, LOG_ERR, "Error in find_mpg_header");
00614 return re;
00615 }
00616
00617 if (ring_peek(rbuf, buf, 5, off) < 0) return -2;
00618 headr=buf+4;
00619
00620 ext_id = (headr[0]&0xF0) >> 4;
00621
00622 switch (ext_id){
00623 case SEQUENCE_EXTENSION:{
00624 uint16_t hsize;
00625 uint16_t vsize;
00626 uint32_t vbvb;
00627 uint32_t bitrate;
00628 uint8_t fr_n, fr_d;
00629
00630
00631 if (s->ext_set || !s->set) break;
00632 if (ring_peek(rbuf, buf, 10, off) < 0) return -2;
00633 headr=buf+4;
00634
00635 if (DEBUG)
00636 LOG(VB_GENERAL, LOG_DEBUG, "Sequence Extension:");
00637 s->profile = ((headr[0]&0x0F) << 4) | ((headr[1]&0xF0) >> 4);
00638 if (headr[1]&0x08) s->progressive = 1;
00639 else s->progressive = 0;
00640 s->chroma = (headr[1]&0x06)>>1;
00641 if (DEBUG){
00642 switch(s->chroma){
00643 case 0:
00644 LOG(VB_GENERAL, LOG_DEBUG, " chroma reserved ");
00645 break;
00646 case 1:
00647 LOG(VB_GENERAL, LOG_DEBUG, " chroma 4:2:0 ");
00648 break;
00649 case 2:
00650 LOG(VB_GENERAL, LOG_DEBUG, " chroma 4:2:2 ");
00651 break;
00652 case 3:
00653 LOG(VB_GENERAL, LOG_DEBUG, " chroma 4:4:4 ");
00654 break;
00655 }
00656 }
00657
00658 hsize = ((headr[1]&0x01)<<12) | ((headr[2]&0x80)<<6);
00659 vsize = ((headr[2]&0x60)<<7);
00660 s->h_size |= hsize;
00661 s->v_size |= vsize;
00662 if (DEBUG)
00663 LOG(VB_GENERAL, LOG_DEBUG, " size = %dx%d",
00664 s->h_size, s->v_size);
00665
00666 bitrate = ((headr[2]& 0x1F) << 25) | (( headr[3] & 0xFE ) << 17);
00667 s->bit_rate |= bitrate;
00668
00669 if (DEBUG)
00670 LOG(VB_GENERAL, LOG_DEBUG, " bit rate: %.2f Mbit/s",
00671 400.0*(s->bit_rate)/1000000.0);
00672
00673
00674 vbvb = (headr[4]<<10);
00675 s->vbv_buffer_size |= vbvb;
00676 if (DEBUG)
00677 LOG(VB_GENERAL, LOG_DEBUG, " vbvbuffer %d",
00678 16*1024*(s->vbv_buffer_size));
00679 fr_n = (headr[5] & 0x60) >> 6;
00680 fr_d = (headr[5] & 0x1F);
00681
00682 s->frame_rate = s->frame_rate * (fr_n+1) / (fr_d+1);
00683 if (DEBUG)
00684 LOG(VB_GENERAL, LOG_DEBUG, " frame rate: %2.3f",
00685 s->frame_rate/1000.0);
00686 s->ext_set=1;
00687 break;
00688 }
00689
00690 case SEQUENCE_DISPLAY_EXTENSION:
00691 break;
00692
00693 case PICTURE_CODING_EXTENSION:{
00694 int pulldown = 0;
00695
00696 if (!s->set || s->pulldown_set) break;
00697 if (ring_peek(rbuf, buf, 10, off) < 0) return -2;
00698 headr=buf+4;
00699
00700 if ( (headr[2]&0x03) != 0x03 ) break;
00701 if ( (headr[3]&0x02) ) pulldown = 1;
00702
00703 if (pulldown){
00704 if (s->current_tmpref)
00705 s->pulldown = PULLDOWN23;
00706 else
00707 s->pulldown = PULLDOWN32;
00708 s->pulldown_set = 1;
00709 }
00710 if (DEBUG){
00711 switch (s->pulldown) {
00712 case PULLDOWN32:
00713 LOG(VB_GENERAL, LOG_DEBUG,
00714 "Picture Coding Extension: "
00715 "3:2 pulldown detected");
00716 break;
00717 case PULLDOWN23:
00718 LOG(VB_GENERAL, LOG_DEBUG,
00719 "Picture Coding Extension: "
00720 "2:3 pulldown detected");
00721 break;
00722 #if 0
00723 default:
00724 LOG(VB_GENERAL, INFO_DEBUG,
00725 " no pulldown detected");
00726 #endif
00727 }
00728 }
00729 break;
00730 }
00731 case QUANT_MATRIX_EXTENSION:
00732 break;
00733 case PICTURE_DISPLAY_EXTENSION:
00734 break;
00735 }
00736
00737
00738 return ext_id;
00739 }
00740