Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -32,6 +32,8 @@ · 31 unmodified lines | |||
| 32 | #include "avformat.h" | 32 | #include "avformat.h" |
| 33 | #include "internal.h" | 33 | #include "internal.h" |
| 34 | 34 | ||
| 35 | #include "libavutil/channel_layout.h" | ||
| 36 | |||
| 35 | typedef struct CdataDemuxContext { | 37 | typedef struct CdataDemuxContext { |
| 36 | unsigned int channels; | 38 | unsigned int channels; |
| 37 | unsigned int audio_pts; | 39 | unsigned int audio_pts; |
| @@ -52,18 +54,25 @@ static int cdata_read_header(AVFormatContext *s) · 14 unmodified lines | |||
| 52 | AVIOContext *pb = s->pb; | 54 | AVIOContext *pb = s->pb; |
| 53 | unsigned int sample_rate, header; | 55 | unsigned int sample_rate, header; |
| 54 | AVStream *st; | 56 | AVStream *st; |
| 55 | int64_t channel_layout = 0; | 57 | AVChannelLayout channel_layout; |
| 56 | 58 | ||
| 57 | header = avio_rb16(pb); | 59 | header = avio_rb16(pb); |
| 58 | switch (header) { | 60 | switch (header) { |
| 59 | case 0x0400: cdata->channels = 1; break; | 61 | case 0x0400: |
| 60 | case 0x0404: cdata->channels = 2; break; | 62 | channel_layout = (AVChannelLayout){ .nb_channels = 1, .order = AV_CHANNEL_ORDER_UNSPEC }; |
| 61 | case 0x040C: cdata->channels = 4; channel_layout = AV_CH_LAYOUT_QUAD; break; | 63 | break; |
| 62 | case 0x0414: cdata->channels = 6; channel_layout = AV_CH_LAYOUT_5POINT1_BACK; break; | 64 | case 0x0404: |
| 65 | channel_layout = (AVChannelLayout){ .nb_channels = 2, .order = AV_CHANNEL_ORDER_UNSPEC }; | ||
| 66 | break; | ||
| 67 | case 0x040C: | ||
| 68 | channel_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD; break; | ||
| 69 | case 0x0414: | ||
| 70 | channel_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK; break; | ||
| 63 | default: | 71 | default: |
| 64 | av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header); | 72 | av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header); |
| 65 | return -1; | 73 | return -1; |
| 66 | }; | 74 | }; |
| 75 | cdata->channels = channel_layout.nb_channels; | ||
| 67 | 76 | ||
| 68 | sample_rate = avio_rb16(pb); | 77 | sample_rate = avio_rb16(pb); |
| 69 | avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11); | 78 | avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11); |
| @@ -74,8 +83,7 @@ static int cdata_read_header(AVFormatContext *s) · 4 unmodified lines | |||
| 74 | st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; | 83 | st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
| 75 | st->codecpar->codec_tag = 0; /* no fourcc */ | 84 | st->codecpar->codec_tag = 0; /* no fourcc */ |
| 76 | st->codecpar->codec_id = AV_CODEC_ID_ADPCM_EA_XAS; | 85 | st->codecpar->codec_id = AV_CODEC_ID_ADPCM_EA_XAS; |
| 77 | st->codecpar->channels = cdata->channels; | 86 | st->codecpar->ch_layout = channel_layout; |
| 78 | st->codecpar->channel_layout = channel_layout; | ||
| 79 | st->codecpar->sample_rate = sample_rate; | 87 | st->codecpar->sample_rate = sample_rate; |
| 80 | avpriv_set_pts_info(st, 64, 1, sample_rate); | 88 | avpriv_set_pts_info(st, 64, 1, sample_rate); |
| 81 | 89 | ||