comparison libmpdemux/demux_mov.c @ 4645:33c2fc18138c

added nmhd, added checking for audio trak in demux_mov_fill_buffer
author alex
date Sun, 10 Feb 2002 18:31:12 +0000
parents 080882dddb2e
children 59eb588c7115
comparison
equal deleted inserted replaced
4644:c19fe4030bd4 4645:33c2fc18138c
332 trak->type=MOV_TRAK_AUDIO; 332 trak->type=MOV_TRAK_AUDIO;
333 // read audio data 333 // read audio data
334 break; 334 break;
335 } 335 }
336 case MOV_FOURCC('g','m','h','d'): { 336 case MOV_FOURCC('g','m','h','d'): {
337 mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sGeneric header!\n",level,"");
338 trak->type=MOV_TRAK_GENERIC;
339 break;
340 }
341 case MOV_FOURCC('n','m','h','d'): {
337 mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sGeneric header!\n",level,""); 342 mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sGeneric header!\n",level,"");
338 trak->type=MOV_TRAK_GENERIC; 343 trak->type=MOV_TRAK_GENERIC;
339 break; 344 break;
340 } 345 }
341 case MOV_FOURCC('s','t','s','d'): { 346 case MOV_FOURCC('s','t','s','d'): {
945 if(trak->pos>=trak->chunks_size) return 0; // EOF 950 if(trak->pos>=trak->chunks_size) return 0; // EOF
946 stream_seek(demuxer->stream,trak->chunks[trak->pos].pos); 951 stream_seek(demuxer->stream,trak->chunks[trak->pos].pos);
947 pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale; 952 pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale;
948 if(trak->samplesize!=1) 953 if(trak->samplesize!=1)
949 { 954 {
950 mp_msg(MSGT_DEMUX, MSGL_WARN, "WARNING! Samplesize(%d) != 1\n", 955 mp_msg(MSGT_DEMUX, MSGL_DBG2, "WARNING! Samplesize(%d) != 1\n",
951 trak->samplesize); 956 trak->samplesize);
952 x=trak->chunks[trak->pos].size*trak->samplesize; 957 x=trak->chunks[trak->pos].size*trak->samplesize;
953 } 958 }
954 else 959 else
955 x=trak->chunks[trak->pos].size; 960 x=trak->chunks[trak->pos].size;
956 // printf("X = %d\n", x); 961 // printf("X = %d\n", x);
962 /* the following stuff is audio related */
963 if (trak->type == MOV_TRAK_AUDIO)
964 {
957 if(trak->stdata_len>=36 && trak->stdata[30] && trak->stdata[31]){ 965 if(trak->stdata_len>=36 && trak->stdata[30] && trak->stdata[31]){
958 // extended stsd header - works for CBR MP3: 966 // extended stsd header - works for CBR MP3:
959 x/=(trak->stdata[30]<<8)+trak->stdata[31]; // samples/packet 967 x/=(trak->stdata[30]<<8)+trak->stdata[31]; // samples/packet
960 // x*=(trak->stdata[34]<<8)+trak->stdata[35]; // bytes/packet 968 // x*=(trak->stdata[34]<<8)+trak->stdata[35]; // bytes/packet
961 x*=(trak->stdata[38]<<8)+trak->stdata[39]; // bytes/frame 969 x*=(trak->stdata[38]<<8)+trak->stdata[39]; // bytes/frame
965 x/=ds->ss_div; x*=ds->ss_mul; // compression ratio fix ! HACK ! 973 x/=ds->ss_div; x*=ds->ss_mul; // compression ratio fix ! HACK !
966 } else { 974 } else {
967 x*=(trak->stdata[18]<<8)+trak->stdata[19];x/=8; // bits/sample 975 x*=(trak->stdata[18]<<8)+trak->stdata[19];x/=8; // bits/sample
968 } 976 }
969 } 977 }
978 } /* MOV_TRAK_AUDIO */
970 ds_read_packet(ds,demuxer->stream,x,pts,trak->chunks[trak->pos].pos,0); 979 ds_read_packet(ds,demuxer->stream,x,pts,trak->chunks[trak->pos].pos,0);
971 if(ds==demuxer->audio) mp_msg(MSGT_DEMUX, MSGL_DBG2, "sample %d bytes pts %5.3f\n",trak->chunks[trak->pos].size*trak->samplesize,pts); 980 if(ds==demuxer->audio) mp_msg(MSGT_DEMUX, MSGL_DBG2, "sample %d bytes pts %5.3f\n",trak->chunks[trak->pos].size*trak->samplesize,pts);
972 } else { 981 } else {
973 // read sample: 982 // read sample:
974 if(trak->pos>=trak->samples_size) return 0; // EOF 983 if(trak->pos>=trak->samples_size) return 0; // EOF