History

eac: convert to new channel layout API

Vittorio Giovara committed 9 years ago

Commit b8ae11c1 parent 590d9d61 file · +15 −7Browse files

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/eacdata.c+15−7
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #include "avformat.h"
3333 #include "internal.h"
3434
35+#include "libavutil/channel_layout.h"
36+
3537 typedef struct CdataDemuxContext {
3638 unsigned int channels;
3739 unsigned int audio_pts;
@@ -52,18 +54,25 @@ static int cdata_read_header(AVFormatContext *s) · 14 unmodified lines
5254 AVIOContext *pb = s->pb;
5355 unsigned int sample_rate, header;
5456 AVStream *st;
55− int64_t channel_layout = 0;
57+ AVChannelLayout channel_layout;
5658
5759 header = avio_rb16(pb);
5860 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;
6371 default:
6472 av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header);
6573 return -1;
6674 };
75+ cdata->channels = channel_layout.nb_channels;
6776
6877 sample_rate = avio_rb16(pb);
6978 avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11);
@@ -74,8 +83,7 @@ static int cdata_read_header(AVFormatContext *s) · 4 unmodified lines
7483 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
7584 st->codecpar->codec_tag = 0; /* no fourcc */
7685 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;
7987 st->codecpar->sample_rate = sample_rate;
8088 avpriv_set_pts_info(st, 64, 1, sample_rate);
8189

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t