comparison libmpdemux/demux_real.c @ 7085:02aa64b49b70

some files has some shit before teh audio/video headers...
author arpi
date Sun, 25 Aug 2002 00:07:15 +0000
parents ffd4c6024cdb
children 79b00f519134
comparison
equal deleted inserted replaced
7084:ffd4c6024cdb 7085:02aa64b49b70
6 Based on FFmpeg's libav/rm.c. 6 Based on FFmpeg's libav/rm.c.
7 7
8 TODO: fix the whole syncing mechanism 8 TODO: fix the whole syncing mechanism
9 9
10 $Log$ 10 $Log$
11 Revision 1.24 2002/08/25 00:07:15 arpi
12 some files has some shit before teh audio/video headers...
13
11 Revision 1.23 2002/08/24 23:07:34 arpi 14 Revision 1.23 2002/08/24 23:07:34 arpi
12 10l - fixed chunktab size calculation 15 10l - fixed chunktab size calculation
13 16
14 Revision 1.22 2002/08/24 22:39:27 arpi 17 Revision 1.22 2002/08/24 22:39:27 arpi
15 - changed re-muxed packet structure (see struct dp_hdr_t) 18 - changed re-muxed packet structure (see struct dp_hdr_t)
883 /* Type specific header */ 886 /* Type specific header */
884 codec_data_size = stream_read_dword(demuxer->stream); 887 codec_data_size = stream_read_dword(demuxer->stream);
885 codec_pos = stream_tell(demuxer->stream); 888 codec_pos = stream_tell(demuxer->stream);
886 889
887 tmp = stream_read_dword(demuxer->stream); 890 tmp = stream_read_dword(demuxer->stream);
891
892 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_real: type_spec: len=%d fpos=0x%X first_dword=0x%X (%.4s) \n",
893 (int)codec_data_size,(int)codec_pos,tmp,&tmp);
894
895 #if 1
896 // skip unknown shit - FIXME: find a better/cleaner way!
897 { int len=codec_data_size;
898 while(--len>=8){
899 if(tmp==MKTAG(0xfd, 'a', 'r', '.')) break; // audio
900 if(tmp==MKTAG('O', 'D', 'I', 'V')) break; // video
901 tmp=(tmp<<8)|stream_read_char(demuxer->stream);
902 }
903 }
904 #endif
888 905
889 #define stream_skip(st,siz) { int i; for(i=0;i<siz;i++) mp_msg(MSGT_DEMUX,MSGL_V," %02X",stream_read_char(st)); mp_msg(MSGT_DEMUX,MSGL_V,"\n");} 906 #define stream_skip(st,siz) { int i; for(i=0;i<siz;i++) mp_msg(MSGT_DEMUX,MSGL_V," %02X",stream_read_char(st)); mp_msg(MSGT_DEMUX,MSGL_V,"\n");}
890 907
891 if (tmp == MKTAG(0xfd, 'a', 'r', '.')) 908 if (tmp == MKTAG(0xfd, 'a', 'r', '.'))
892 { 909 {
893 /* audio header */ 910 /* audio header */
894 sh_audio_t *sh = new_sh_audio(demuxer, stream_id); 911 sh_audio_t *sh = new_sh_audio(demuxer, stream_id);
895 char buf[128]; /* for codec name */ 912 char buf[128]; /* for codec name */
1034 #undef stream_skip 1051 #undef stream_skip
1035 1052
1036 } 1053 }
1037 else 1054 else
1038 // case MKTAG('V', 'I', 'D', 'O'): 1055 // case MKTAG('V', 'I', 'D', 'O'):
1056 if(tmp == MKTAG('O', 'D', 'I', 'V'))
1039 { 1057 {
1040 /* video header */ 1058 /* video header */
1041 sh_video_t *sh = new_sh_video(demuxer, stream_id); 1059 sh_video_t *sh = new_sh_video(demuxer, stream_id);
1042 1060
1043 tmp = stream_read_dword_le(demuxer->stream);
1044 mp_msg(MSGT_DEMUX,MSGL_V,"video: %.4s (%x)\n", (char *)&tmp, tmp);
1045 if (tmp != MKTAG('V', 'I', 'D', 'O'))
1046 {
1047 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not audio/video stream or unsupported!\n");
1048 goto skip_this_chunk;
1049 }
1050
1051 sh->format = stream_read_dword_le(demuxer->stream); /* fourcc */ 1061 sh->format = stream_read_dword_le(demuxer->stream); /* fourcc */
1052 mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format); 1062 mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
1053 1063
1054 /* emulate BITMAPINFOHEADER */ 1064 /* emulate BITMAPINFOHEADER */
1055 sh->bih = malloc(sizeof(BITMAPINFOHEADER)+8); 1065 sh->bih = malloc(sizeof(BITMAPINFOHEADER)+8);
1125 priv->v_streams[priv->last_v_stream] = stream_id; 1135 priv->v_streams[priv->last_v_stream] = stream_id;
1126 priv->last_v_stream++; 1136 priv->last_v_stream++;
1127 } 1137 }
1128 // priv->current_vid = stream_id; 1138 // priv->current_vid = stream_id;
1129 } 1139 }
1140 else {
1141 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not audio/video stream or unsupported!\n");
1142 }
1130 // break; 1143 // break;
1131 // default: 1144 // default:
1132 skip_this_chunk: 1145 skip_this_chunk:
1133 /* skip codec info */ 1146 /* skip codec info */
1134 tmp = stream_tell(demuxer->stream) - codec_pos; 1147 tmp = stream_tell(demuxer->stream) - codec_pos;