diff options
Diffstat (limited to 'libmpdemux')
58 files changed, 1154 insertions, 1154 deletions
diff --git a/libmpdemux/aac_hdr.c b/libmpdemux/aac_hdr.c index b9ca15c748..e9c4f5dcc7 100644 --- a/libmpdemux/aac_hdr.c +++ b/libmpdemux/aac_hdr.c @@ -31,10 +31,10 @@ int aac_parse_frame(uint8_t *buf, int *srate, int *num) { int i = 0, sr, fl = 0, id; static int srates[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0, 0, 0}; - + if((buf[i] != 0xFF) || ((buf[i+1] & 0xF6) != 0xF0)) return 0; - + id = (buf[i+1] >> 3) & 0x01; //id=1 mpeg2, 0: mpeg4 sr = (buf[i+2] >> 2) & 0x0F; if(sr > 11) diff --git a/libmpdemux/asf.h b/libmpdemux/asf.h index b97089bc15..b8cd4374ff 100644 --- a/libmpdemux/asf.h +++ b/libmpdemux/asf.h @@ -25,7 +25,7 @@ #include "mpbswap.h" /////////////////////// -// ASF Object Header +// ASF Object Header /////////////////////// typedef struct __attribute__((packed)) { uint8_t guid[16]; @@ -33,7 +33,7 @@ typedef struct __attribute__((packed)) { } ASF_obj_header_t; //////////////// -// ASF Header +// ASF Header //////////////// typedef struct __attribute__((packed)) { ASF_obj_header_t objh; @@ -43,7 +43,7 @@ typedef struct __attribute__((packed)) { } ASF_header_t; ///////////////////// -// ASF File Header +// ASF File Header ///////////////////// typedef struct __attribute__((packed)) { uint8_t stream_id[16]; // stream GUID @@ -84,7 +84,7 @@ typedef struct __attribute__((packed)) { } ASF_content_description_t; //////////////////////// -// ASF Segment Header +// ASF Segment Header //////////////////////// typedef struct __attribute__((packed)) { uint8_t streamno; diff --git a/libmpdemux/asfguid.h b/libmpdemux/asfguid.h index f5a9989e9f..135da26bce 100644 --- a/libmpdemux/asfguid.h +++ b/libmpdemux/asfguid.h @@ -75,9 +75,9 @@ static const char asf_metadata_header[16] = {0xea, 0xcb, 0xf8, 0xc5, 0xaf, 0x5b, 0x77, 0x48, 0x84, 0x67, 0xaa, 0x8c, 0x44, 0xfa, 0x4c, 0xca}; static const char asf_content_encryption[16] = {0xfb, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e}; -static const char asf_dvr_ms_timing_rep_data[16] = {0x2a, 0xc0, 0x3c,0xfd, +static const char asf_dvr_ms_timing_rep_data[16] = {0x2a, 0xc0, 0x3c,0xfd, 0xdb, 0x06, 0xfa, 0x4c, 0x80, 0x1c, 0x72, 0x12, 0xd3, 0x87, 0x45, 0xe4}; -static const char asf_dvr_ms_vid_frame_rep_data[16] = {0xcc, 0x32, 0x64, 0xdd, +static const char asf_dvr_ms_vid_frame_rep_data[16] = {0xcc, 0x32, 0x64, 0xdd, 0x29, 0xe2, 0xdb, 0x40, 0x80, 0xf6, 0xd2, 0x63, 0x28, 0xd2, 0x76, 0x1f}; static int find_asf_guid(char *buf, const char *guid, int cur_pos, int buf_len) diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index 643f08c0ce..727baccf0b 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -77,7 +77,7 @@ static const char* asf_chunk_type(unsigned char* guid) { return "guid_ext_audio_stream"; case ASF_GUID_PREFIX_ext_stream_embed_stream_header: return "guid_ext_stream_embed_stream_header"; - case ASF_GUID_PREFIX_video_stream: + case ASF_GUID_PREFIX_video_stream: return "guid_video_stream"; case ASF_GUID_PREFIX_audio_conceal_none: return "guid_audio_conceal_none"; @@ -91,7 +91,7 @@ static const char* asf_chunk_type(unsigned char* guid) { return "guid_index_chunk"; case ASF_GUID_PREFIX_stream_header: return "guid_stream_header"; - case ASF_GUID_PREFIX_header_2_0: + case ASF_GUID_PREFIX_header_2_0: return "guid_header_2_0"; case ASF_GUID_PREFIX_file_header: return "guid_file_header"; @@ -179,7 +179,7 @@ static int get_ext_stream_properties(char *buf, int buf_len, int stream_num, str stnamect = AV_RL16(buffer);buffer+=2; payct = AV_RL16(buffer);buffer+=2; - // need to read stream names if present in order + // need to read stream names if present in order // to get lengths - values are ignored for now for (i=0; i<stnamect; i++) { int stream_name_len; @@ -331,7 +331,7 @@ static int is_drm(char* buf, int buf_len) buf += 4; buf[key_len - 1] = '\0'; - mp_msg(MSGT_HEADER, MSGL_V, "DRM Key ID: %s\n", buf); + mp_msg(MSGT_HEADER, MSGL_V, "DRM Key ID: %s\n", buf); buf += key_len; url_len = AV_RL32(buf); @@ -341,7 +341,7 @@ static int is_drm(char* buf, int buf_len) buf[url_len - 1] = '\0'; mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_ASFHDR_DRMLicenseURL, buf); return 1; -} +} static int asf_init_audio_stream(demuxer_t *demuxer,struct asf_priv* asf, sh_audio_t* sh_audio, ASF_stream_header_t *streamh, int *ppos, uint8_t** buf, char *hdr, unsigned int hdr_len) { @@ -400,7 +400,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ mp_msg(MSGT_HEADER, MSGL_FATAL, "Header size is too small.\n"); return 0; } - + if (hdr_len > 1024 * 1024) { mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB, hdr_len); @@ -431,7 +431,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ int sh_pos=0; sh_pos = find_backwards_asf_guid(hdr, asf_stream_header_guid, pos); - + if (sh_pos > 0) { sh_audio_t *sh_audio; @@ -455,7 +455,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ // find stream headers // only reset pos if we didnt find dvr_ms audio stream // if we did find it then we want to avoid reading its header twice - if (audio_pos == 0) + if (audio_pos == 0) pos = 0; while ((pos = find_asf_guid(hdr, asf_stream_header_guid, pos, hdr_len)) >= 0) @@ -538,7 +538,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ mp_msg(MSGT_HEADER, MSGL_V, "ASF: packets: %d flags: %d " "max_packet_size: %d min_packet_size: %d max_bitrate: %d " "preroll: %d\n", - (int)fileh->num_packets, (int)fileh->flags, + (int)fileh->num_packets, (int)fileh->flags, (int)fileh->min_packet_size, (int)fileh->max_packet_size, (int)fileh->max_bitrate, (int)fileh->preroll); asf->packetsize=fileh->max_packet_size; @@ -569,7 +569,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ free(string); } } - // extract the author + // extract the author if((len = contenth->author_size) != 0) { wstring = (uint16_t*)&hdr[pos]; pos += len; @@ -614,7 +614,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ } mp_msg(MSGT_HEADER,MSGL_V,"\n"); } - + // find content header pos = find_asf_guid(hdr, asf_stream_group_guid, 0, hdr_len); if (pos >= 0) { @@ -696,7 +696,7 @@ else if(best_audio > 0 && demuxer->audio->id == -1) demuxer->audio->id=best_audi if(!video_streams){ if(!audio_streams){ mp_msg(MSGT_HEADER,MSGL_ERR,MSGTR_MPDEMUX_ASFHDR_AudioVideoHeaderNotFound); - return 0; + return 0; } demuxer->video->id=-2; // audio-only } else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video; diff --git a/libmpdemux/aviheader.c b/libmpdemux/aviheader.c index 1a6278dbb3..0b7380cf68 100644 --- a/libmpdemux/aviheader.c +++ b/libmpdemux/aviheader.c @@ -247,9 +247,9 @@ while(1){ *(uint32_t *)s->dwChunkId = stream_read_dword_le(demuxer->stream); stream_read(demuxer->stream, (char *)s->dwReserved, 3*4); memset(s->dwReserved, 0, 3*4); - + print_avisuperindex_chunk(s,MSGL_V); - + // Check and fix this useless crap if(s->wLongsPerEntry != sizeof (avisuperindex_entry)/4) { mp_msg (MSGT_HEADER, MSGL_WARN, "Broken super index chunk size: %u\n",s->wLongsPerEntry); @@ -269,7 +269,7 @@ while(1){ s->aIndex[i].qwOffset = stream_read_qword_le(demuxer->stream); s->aIndex[i].dwSize = stream_read_dword_le(demuxer->stream); s->aIndex[i].dwDuration = stream_read_dword_le(demuxer->stream); - mp_msg (MSGT_HEADER, MSGL_V, "ODML (%.4s): [%d] 0x%016"PRIx64" 0x%04x %u\n", + mp_msg (MSGT_HEADER, MSGL_V, "ODML (%.4s): [%d] 0x%016"PRIx64" 0x%04x %u\n", (s->dwChunkId), i, (uint64_t)s->aIndex[i].qwOffset, s->aIndex[i].dwSize, s->aIndex[i].dwDuration); } @@ -459,7 +459,7 @@ while(1){ } else if(chunksize>0) stream_skip(demuxer->stream,chunksize); else if((int)chunksize<0) mp_msg(MSGT_HEADER,MSGL_WARN,"chunksize=%u (id=%.4s)\n",chunksize,(char *) &id); - + } if (priv->suidx_size > 0 && priv->idx_size == 0) { @@ -504,7 +504,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) { print_avistdindex_chunk(&cx->stdidx[j],MSGL_V); priv->idx_size += cx->stdidx[j].nEntriesInUse; cx->stdidx[j].aIndex = malloc(cx->stdidx[j].nEntriesInUse*sizeof(avistdindex_entry)); - stream_read(demuxer->stream, (char *)cx->stdidx[j].aIndex, + stream_read(demuxer->stream, (char *)cx->stdidx[j].aIndex, cx->stdidx[j].nEntriesInUse*sizeof(avistdindex_entry)); for (k=0;k<cx->stdidx[j].nEntriesInUse; k++) le2me_AVISTDIDXENTRY(&cx->stdidx[j].aIndex[k]); @@ -635,7 +635,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){ // build index for file: stream_reset(demuxer->stream); stream_seek(demuxer->stream,demuxer->movi_start); - + priv->idx_pos=0; priv->idx_size=0; priv->idx=NULL; @@ -669,7 +669,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){ idx->dwFlags|=(demuxer->filepos>>16)&0xffff0000U; idx->dwChunkOffset=(unsigned long)demuxer->filepos; idx->dwChunkLength=len; - + c=stream_read_dword(demuxer->stream); if(!len) idx->dwFlags&=~AVIIF_KEYFRAME; diff --git a/libmpdemux/aviheader.h b/libmpdemux/aviheader.h index 66acc8fc3d..0dd915fc5d 100644 --- a/libmpdemux/aviheader.h +++ b/libmpdemux/aviheader.h @@ -90,10 +90,10 @@ typedef struct uint32_t dwInitialFrames; uint32_t dwStreams; uint32_t dwSuggestedBufferSize; - + uint32_t dwWidth; uint32_t dwHeight; - + uint32_t dwReserved[4]; } MainAVIHeader; @@ -111,7 +111,7 @@ typedef struct { uint16_t wPriority; uint16_t wLanguage; uint32_t dwInitialFrames; - uint32_t dwScale; + uint32_t dwScale; uint32_t dwRate; /* dwRate / dwScale == samples/second */ uint32_t dwStart; uint32_t dwLength; /* In units above... */ @@ -151,7 +151,7 @@ typedef struct avistdindex_entry { uint32_t dwSize; // bit 31 is set if this is NOT a keyframe } avistdindex_entry; -// Standard index +// Standard index typedef struct __attribute__((packed)) avistdindex_chunk { char fcc[4]; // ix## uint32_t dwSize; // size of this chunk @@ -164,7 +164,7 @@ typedef struct __attribute__((packed)) avistdindex_chunk { uint32_t dwReserved3; // must be 0 avistdindex_entry *aIndex; // the actual frames } avistdindex_chunk; - + // Base Index Form 'indx' typedef struct avisuperindex_chunk { diff --git a/libmpdemux/aviprint.c b/libmpdemux/aviprint.c index 00461f6c9f..f12451a6b4 100644 --- a/libmpdemux/aviprint.c +++ b/libmpdemux/aviprint.c @@ -184,7 +184,7 @@ void print_avisuperindex_chunk(avisuperindex_chunk *h, int verbose_level){ mp_msg (MSGT_HEADER, verbose_level, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry); mp_msg (MSGT_HEADER, verbose_level, " bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType); mp_msg (MSGT_HEADER, verbose_level, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId); - mp_msg (MSGT_HEADER, verbose_level, " dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", + mp_msg (MSGT_HEADER, verbose_level, " dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", h->dwReserved[0], h->dwReserved[1], h->dwReserved[2]); mp_msg (MSGT_HEADER, verbose_level, "===========================\n"); } diff --git a/libmpdemux/demux_aac.c b/libmpdemux/demux_aac.c index ee9f1e935e..2ebbb2995e 100644 --- a/libmpdemux/demux_aac.c +++ b/libmpdemux/demux_aac.c @@ -48,11 +48,11 @@ int aac_parse_frame(uint8_t *buf, int *srate, int *num); static int demux_aac_init(demuxer_t *demuxer) { aac_priv_t *priv; - + priv = calloc(1, sizeof(aac_priv_t)); if(!priv) return 0; - + priv->buf = (uint8_t*) malloc(8); if(!priv->buf) { @@ -67,7 +67,7 @@ static int demux_aac_init(demuxer_t *demuxer) static void demux_close_aac(demuxer_t *demuxer) { aac_priv_t *priv = (aac_priv_t *) demuxer->priv; - + if(!priv) return; @@ -85,13 +85,13 @@ static int demux_aac_probe(demuxer_t *demuxer) int cnt = 0, c, len, srate, num; off_t init, probed; aac_priv_t *priv; - + if(! demux_aac_init(demuxer)) { mp_msg(MSGT_DEMUX, MSGL_ERR, "COULDN'T INIT aac_demux, exit\n"); return 0; } - + priv = (aac_priv_t *) demuxer->priv; init = probed = stream_tell(demuxer->stream); @@ -107,7 +107,7 @@ static int demux_aac_probe(demuxer_t *demuxer) priv->buf[0] = 0xFF; if(stream_read(demuxer->stream, &(priv->buf[1]), 7) < 7) goto fail; - + len = aac_parse_frame(priv->buf, &srate, &num); if(len > 0) { @@ -120,7 +120,7 @@ static int demux_aac_probe(demuxer_t *demuxer) stream_seek(demuxer->stream, init); if(cnt < 8) goto fail; - + mp_msg(MSGT_DEMUX, MSGL_V, "demux_aac_probe, INIT: %"PRIu64", PROBED: %"PRIu64", cnt: %d\n", init, probed, cnt); return DEMUXER_TYPE_AAC; @@ -140,7 +140,7 @@ static demuxer_t* demux_aac_open(demuxer_t *demuxer) demuxer->audio->sh = sh; demuxer->filepos = stream_tell(demuxer->stream); - + return demuxer; } @@ -173,7 +173,7 @@ static int demux_aac_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) priv->buf[1] = (unsigned char) c2; if(stream_read(demuxer->stream, &(priv->buf[2]), 6) < 6) return 0; - + len = aac_parse_frame(priv->buf, &srate, &num); if(len > 0) { @@ -183,8 +183,8 @@ static int demux_aac_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) mp_msg(MSGT_DEMUX, MSGL_ERR, "fill_buffer, NEW_ADD_PACKET(%d)FAILED\n", len); return 0; } - - + + memcpy(dp->buffer, priv->buf, 8); stream_read(demuxer->stream, &(dp->buffer[8]), len-8); if(srate) @@ -195,10 +195,10 @@ static int demux_aac_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) ds_add_packet(demuxer->audio, dp); priv->size += len; priv->time += tm; - + priv->bitrate = (int) (priv->size / priv->time); demuxer->filepos = stream_tell(demuxer->stream); - + return len; } else @@ -220,7 +220,7 @@ static void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_ ds_free_packs(d_audio); time = (flags & SEEK_ABSOLUTE) ? rel_seek_secs - priv->last_pts : rel_seek_secs; - if(time < 0) + if(time < 0) { stream_seek(demuxer->stream, demuxer->movi_start); time = priv->last_pts + time; @@ -232,13 +232,13 @@ static void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_ int len, nf, srate, num; nf = time * sh_audio->samplerate/1024; - - while(nf > 0) + + while(nf > 0) { if(stream_read(demuxer->stream,priv->buf, 8) < 8) break; len = aac_parse_frame(priv->buf, &srate, &num); - if(len <= 0) + if(len <= 0) { stream_skip(demuxer->stream, -7); continue; diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c index 44e05af9e8..07e5972ef1 100644 --- a/libmpdemux/demux_asf.c +++ b/libmpdemux/demux_asf.c @@ -116,9 +116,9 @@ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,in struct asf_priv* asf = demux->priv; demux_stream_t *ds=NULL; int close_seg=0; - + mp_dbg(MSGT_DEMUX,MSGL_DBG4,"demux_asf.read_packet: id=%d seq=%d len=%d\n",id,seq,len); - + if(demux->video->id==-1) if(demux->v_streams[id]) demux->video->id=id; @@ -134,7 +134,7 @@ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,in ds->sh=demux->a_streams[id]; mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected ASF audio ID = %d\n",ds->id); } - } else + } else if(id==demux->video->id){ // video ds=demux->video; @@ -143,7 +143,7 @@ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,in mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected ASF video ID = %d\n",ds->id); } } - + if(ds){ if(ds->asf_packet){ demux_packet_t* dp=ds->asf_packet; @@ -230,7 +230,7 @@ static void get_payload_extension_data(demuxer_t *demux, unsigned char** pp, uns *seg_time=0.0; asf->new_vid_frame_seg = 0; - for (i=0; i<ext_max; i++) { + for (i=0; i<ext_max; i++) { uint16_t payextsize; uint8_t segment_marker; @@ -243,12 +243,12 @@ static void get_payload_extension_data(demuxer_t *demux, unsigned char** pp, uns payextsize = AV_RL16(pi); pi+=2; } - + // if this is the timing info extension then read the payload time if (i == ext_timing_index) payload_time = AV_RL64(pi+8); - - // if this is the video frame info extension then + + // if this is the video frame info extension then // set the keyframe indicator, the 'new frame segment' indicator // and (initially) the 'frame time' if (i == asf->vid_ext_frame_index && id==demux->video->id) { @@ -271,7 +271,7 @@ static void get_payload_extension_data(demuxer_t *demux, unsigned char** pp, uns // ^ this is new video frame marker // // ^^^^ these bits indicate the framerate - // 0X4 is 29.97i, 0X3 is 25i, 0X7 is 29.97p, ???=25p + // 0X4 is 29.97i, 0X3 is 25i, 0X7 is 29.97p, ???=25p // // ^^^ these bits indicate the frame type: // 001 means I-frame @@ -282,7 +282,7 @@ static void get_payload_extension_data(demuxer_t *demux, unsigned char** pp, uns if (asf->new_vid_frame_seg) asf->last_vid_seq = seq; |