forked from FFmpeg/FFmpeg
remove code that discards streams randomly
Originally committed as revision 13997 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
e100245441
commit
73d3a14d82
1 changed files with 15 additions and 23 deletions
|
@ -52,6 +52,7 @@
|
||||||
typedef struct StrChannel {
|
typedef struct StrChannel {
|
||||||
/* video parameters */
|
/* video parameters */
|
||||||
int video_stream_index;
|
int video_stream_index;
|
||||||
|
AVPacket tmp_pkt;
|
||||||
|
|
||||||
/* audio parameters */
|
/* audio parameters */
|
||||||
int audio_stream_index;
|
int audio_stream_index;
|
||||||
|
@ -62,13 +63,7 @@ typedef struct StrDemuxContext {
|
||||||
/* a STR file can contain up to 32 channels of data */
|
/* a STR file can contain up to 32 channels of data */
|
||||||
StrChannel channels[32];
|
StrChannel channels[32];
|
||||||
|
|
||||||
/* only decode the first audio and video channels encountered */
|
|
||||||
int video_channel;
|
|
||||||
int audio_channel;
|
|
||||||
|
|
||||||
int64_t pts;
|
int64_t pts;
|
||||||
|
|
||||||
AVPacket tmp_pkt;
|
|
||||||
} StrDemuxContext;
|
} StrDemuxContext;
|
||||||
|
|
||||||
static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00};
|
static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00};
|
||||||
|
@ -124,9 +119,6 @@ static int str_read_header(AVFormatContext *s,
|
||||||
|
|
||||||
/* initialize context members */
|
/* initialize context members */
|
||||||
str->pts = 0;
|
str->pts = 0;
|
||||||
str->audio_channel = -1; /* assume to audio or video */
|
|
||||||
str->video_channel = -1;
|
|
||||||
|
|
||||||
|
|
||||||
/* skip over any RIFF header */
|
/* skip over any RIFF header */
|
||||||
if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
|
if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
|
||||||
|
@ -138,6 +130,11 @@ static int str_read_header(AVFormatContext *s,
|
||||||
|
|
||||||
url_fseek(pb, start, SEEK_SET);
|
url_fseek(pb, start, SEEK_SET);
|
||||||
|
|
||||||
|
for(i=0; i<32; i++){
|
||||||
|
str->channels[i].video_stream_index=
|
||||||
|
str->channels[i].audio_stream_index= -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* check through the first 32 sectors for individual channels */
|
/* check through the first 32 sectors for individual channels */
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
|
if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
|
||||||
|
@ -153,12 +150,11 @@ static int str_read_header(AVFormatContext *s,
|
||||||
|
|
||||||
case CDXA_TYPE_DATA:
|
case CDXA_TYPE_DATA:
|
||||||
case CDXA_TYPE_VIDEO:
|
case CDXA_TYPE_VIDEO:
|
||||||
/* check if this channel gets to be the dominant video channel */
|
|
||||||
if (str->video_channel == -1) {
|
|
||||||
/* qualify the magic number */
|
/* qualify the magic number */
|
||||||
if (AV_RL32(§or[0x18]) != STR_MAGIC)
|
if (AV_RL32(§or[0x18]) != STR_MAGIC)
|
||||||
break;
|
break;
|
||||||
str->video_channel = channel;
|
if(str->channels[channel].video_stream_index != -1)
|
||||||
|
break;
|
||||||
|
|
||||||
/* allocate a new AVStream */
|
/* allocate a new AVStream */
|
||||||
st = av_new_stream(s, 0);
|
st = av_new_stream(s, 0);
|
||||||
|
@ -173,14 +169,14 @@ static int str_read_header(AVFormatContext *s,
|
||||||
st->codec->codec_tag = 0; /* no fourcc */
|
st->codec->codec_tag = 0; /* no fourcc */
|
||||||
st->codec->width = AV_RL16(§or[0x28]);
|
st->codec->width = AV_RL16(§or[0x28]);
|
||||||
st->codec->height = AV_RL16(§or[0x2A]);
|
st->codec->height = AV_RL16(§or[0x2A]);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CDXA_TYPE_AUDIO:
|
case CDXA_TYPE_AUDIO:
|
||||||
/* check if this channel gets to be the dominant audio channel */
|
{
|
||||||
if (str->audio_channel == -1) {
|
|
||||||
int fmt;
|
int fmt;
|
||||||
str->audio_channel = channel;
|
|
||||||
|
if(str->channels[channel].audio_stream_index != -1)
|
||||||
|
break;
|
||||||
|
|
||||||
/* allocate a new AVStream */
|
/* allocate a new AVStream */
|
||||||
st = av_new_stream(s, 0);
|
st = av_new_stream(s, 0);
|
||||||
|
@ -236,8 +232,7 @@ static int str_read_packet(AVFormatContext *s,
|
||||||
|
|
||||||
case CDXA_TYPE_DATA:
|
case CDXA_TYPE_DATA:
|
||||||
case CDXA_TYPE_VIDEO:
|
case CDXA_TYPE_VIDEO:
|
||||||
/* check if this the video channel we care about */
|
{
|
||||||
if (channel == str->video_channel) {
|
|
||||||
|
|
||||||
int current_sector = AV_RL16(§or[0x1C]);
|
int current_sector = AV_RL16(§or[0x1C]);
|
||||||
int sector_count = AV_RL16(§or[0x1E]);
|
int sector_count = AV_RL16(§or[0x1E]);
|
||||||
|
@ -252,7 +247,7 @@ static int str_read_packet(AVFormatContext *s,
|
||||||
|
|
||||||
// printf("%d %d %d\n",current_sector,sector_count,frame_size);
|
// printf("%d %d %d\n",current_sector,sector_count,frame_size);
|
||||||
/* if this is the first sector of the frame, allocate a pkt */
|
/* if this is the first sector of the frame, allocate a pkt */
|
||||||
pkt = &str->tmp_pkt;
|
pkt = &str->channels[channel].tmp_pkt;
|
||||||
|
|
||||||
if(pkt->size != sector_count*VIDEO_DATA_CHUNK_SIZE){
|
if(pkt->size != sector_count*VIDEO_DATA_CHUNK_SIZE){
|
||||||
if(pkt->data)
|
if(pkt->data)
|
||||||
|
@ -268,7 +263,7 @@ static int str_read_packet(AVFormatContext *s,
|
||||||
|
|
||||||
/* if there is no audio, adjust the pts after every video
|
/* if there is no audio, adjust the pts after every video
|
||||||
* frame; assume 15 fps */
|
* frame; assume 15 fps */
|
||||||
if (str->audio_channel != -1)
|
if (0)
|
||||||
str->pts += (90000 / 15);
|
str->pts += (90000 / 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,8 +287,6 @@ static int str_read_packet(AVFormatContext *s,
|
||||||
printf (" dropping audio sector\n");
|
printf (" dropping audio sector\n");
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
/* check if this the video channel we care about */
|
|
||||||
if (channel == str->audio_channel) {
|
|
||||||
pkt = ret_pkt;
|
pkt = ret_pkt;
|
||||||
if (av_new_packet(pkt, 2304))
|
if (av_new_packet(pkt, 2304))
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
@ -303,7 +296,6 @@ printf (" dropping audio sector\n");
|
||||||
str->channels[channel].audio_stream_index;
|
str->channels[channel].audio_stream_index;
|
||||||
//pkt->pts = str->pts;
|
//pkt->pts = str->pts;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue