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