virtual int audio_channels () const = 0;
virtual ContentAudioFrame audio_length () const = 0;
virtual int audio_frame_rate () const = 0;
- virtual int64_t audio_channel_layout () const = 0;
-
};
#endif
s << String::compose (N_("Will resample audio from %1 to %2"), _film->audio_frame_rate(), _film->target_audio_sample_rate());
_film->log()->log (s.str ());
- /* We will be using planar float data when we call the resampler */
+ /* We will be using planar float data when we call the
+ resampler. As far as I can see, the audio channel
+ layout is not necessary for our purposes; it seems
+ only to be used get the number of channels and
+ decide if rematrixing is needed. It won't be, since
+ input and output layouts are the same.
+ */
+
_swr_context = swr_alloc_set_opts (
0,
- _film->audio_channel_layout(),
+ av_get_default_channel_layout (_film->audio_channels ()),
AV_SAMPLE_FMT_FLTP,
_film->target_audio_sample_rate(),
- _film->audio_channel_layout(),
+ av_get_default_channel_layout (_film->audio_channels ()),
AV_SAMPLE_FMT_FLTP,
_film->audio_frame_rate(),
0, 0
return 0;
}
- return _audio_stream->channels ();
+ return _audio_stream->channels;
}
int
return _audio_stream->frame_rate;
}
-int64_t
-FFmpegContent::audio_channel_layout () const
-{
- if (!_audio_stream) {
- return 0;
- }
-
- return _audio_stream->channel_layout;
-}
-
bool
operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b)
{
name = node->string_child ("Name");
id = node->number_child<int> ("Id");
frame_rate = node->number_child<int> ("FrameRate");
- channel_layout = node->number_child<int64_t> ("ChannelLayout");
+ channels = node->number_child<int64_t> ("Channels");
}
void
root->add_child("Name")->add_child_text (name);
root->add_child("Id")->add_child_text (lexical_cast<string> (id));
root->add_child("FrameRate")->add_child_text (lexical_cast<string> (frame_rate));
- root->add_child("ChannelLayout")->add_child_text (lexical_cast<string> (channel_layout));
+ root->add_child("Channels")->add_child_text (lexical_cast<string> (channels));
}
/** Construct a SubtitleStream from a value returned from to_string().
class FFmpegAudioStream
{
public:
- FFmpegAudioStream (std::string n, int i, int f, int64_t c)
+ FFmpegAudioStream (std::string n, int i, int f, int c)
: name (n)
, id (i)
, frame_rate (f)
- , channel_layout (c)
+ , channels (c)
{}
FFmpegAudioStream (boost::shared_ptr<const cxml::Node>);
void as_xml (xmlpp::Node *) const;
- int channels () const {
- return av_get_channel_layout_nb_channels (channel_layout);
- }
-
std::string name;
int id;
int frame_rate;
- int64_t channel_layout;
+ int channels;
};
extern bool operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b);
int audio_channels () const;
ContentAudioFrame audio_length () const;
int audio_frame_rate () const;
- int64_t audio_channel_layout () const;
std::vector<FFmpegSubtitleStream> subtitle_streams () const {
boost::mutex::scoped_lock lm (_mutex);
}
_audio_streams.push_back (
- FFmpegAudioStream (stream_name (s), i, s->codec->sample_rate, s->codec->channel_layout)
+ FFmpegAudioStream (stream_name (s), i, s->codec->sample_rate, s->codec->channels)
);
} else if (s->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
return _playlist->audio_frame_rate ();
}
-int64_t
-Film::audio_channel_layout () const
-{
- return _playlist->audio_channel_layout ();
-}
-
bool
Film::has_audio () const
{
ContentAudioFrame audio_length () const;
int audio_channels () const;
int audio_frame_rate () const;
- int64_t audio_channel_layout () const;
bool has_audio () const;
float video_frame_rate () const;
libdcp::Size native_size () const;
ContentVideoFrame video_length () const;
- int audio_channels () const {
- return 0;
- }
-
- int audio_sample_rate () const {
- return 0;
- }
-
- int64_t audio_channel_layout () const {
- return 0;
- }
-
bool seek (double);
bool pass ();
return 0;
}
-int64_t
-Playlist::audio_channel_layout () const
-{
- /* XXX: assuming that all content has the same layout */
-
- switch (_audio_from) {
- case AUDIO_FFMPEG:
- {
- shared_ptr<const FFmpegContent> fc = first_ffmpeg ();
- if (fc) {
- return fc->audio_channel_layout ();
- }
- break;
- }
- case AUDIO_SNDFILE:
- /* XXX */
- return 0;
- }
-
- return 0;
-}
-
float
Playlist::video_frame_rate () const
{
ContentAudioFrame audio_length () const;
int audio_channels () const;
int audio_frame_rate () const;
- int64_t audio_channel_layout () const;
bool has_audio () const;
float video_frame_rate () const;
return _audio_frame_rate;
}
- int64_t audio_channel_layout () const {
- return av_get_default_channel_layout (audio_channels ());
- }
-
static bool valid_file (boost::filesystem::path);
private: