mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
correctly set audio codec when demuxing sofdec files
samples: http://samples.mplayerhq.hu/game-formats/sfd/ Originally committed as revision 10953 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
c16d6c5061
commit
8cd4ac3d63
@ -107,15 +107,25 @@ static int mpegps_probe(AVProbeData *p)
|
|||||||
typedef struct MpegDemuxContext {
|
typedef struct MpegDemuxContext {
|
||||||
int32_t header_state;
|
int32_t header_state;
|
||||||
unsigned char psm_es_type[256];
|
unsigned char psm_es_type[256];
|
||||||
|
int sofdec;
|
||||||
} MpegDemuxContext;
|
} MpegDemuxContext;
|
||||||
|
|
||||||
static int mpegps_read_header(AVFormatContext *s,
|
static int mpegps_read_header(AVFormatContext *s,
|
||||||
AVFormatParameters *ap)
|
AVFormatParameters *ap)
|
||||||
{
|
{
|
||||||
MpegDemuxContext *m = s->priv_data;
|
MpegDemuxContext *m = s->priv_data;
|
||||||
|
uint8_t buffer[8192];
|
||||||
|
char *p;
|
||||||
|
|
||||||
m->header_state = 0xff;
|
m->header_state = 0xff;
|
||||||
s->ctx_flags |= AVFMTCTX_NOHEADER;
|
s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||||
|
|
||||||
|
get_buffer(&s->pb, buffer, sizeof(buffer));
|
||||||
|
if ((p=memchr(buffer, 'S', sizeof(buffer))))
|
||||||
|
if (!memcmp(p, "Sofdec", 6))
|
||||||
|
m->sofdec = 1;
|
||||||
|
url_fseek(&s->pb, -sizeof(buffer), SEEK_CUR);
|
||||||
|
|
||||||
/* no need to do more */
|
/* no need to do more */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -449,7 +459,7 @@ static int mpegps_read_packet(AVFormatContext *s,
|
|||||||
type = CODEC_TYPE_VIDEO;
|
type = CODEC_TYPE_VIDEO;
|
||||||
} else if (startcode >= 0x1c0 && startcode <= 0x1df) {
|
} else if (startcode >= 0x1c0 && startcode <= 0x1df) {
|
||||||
type = CODEC_TYPE_AUDIO;
|
type = CODEC_TYPE_AUDIO;
|
||||||
codec_id = CODEC_ID_MP2;
|
codec_id = m->sofdec ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
|
||||||
} else if (startcode >= 0x80 && startcode <= 0x87) {
|
} else if (startcode >= 0x80 && startcode <= 0x87) {
|
||||||
type = CODEC_TYPE_AUDIO;
|
type = CODEC_TYPE_AUDIO;
|
||||||
codec_id = CODEC_ID_AC3;
|
codec_id = CODEC_ID_AC3;
|
||||||
|
Loading…
Reference in New Issue
Block a user