Tabnine Logo
com.netflix.imfutility.audio
Code IndexAdd Tabnine to your IDE (free)

How to use com.netflix.imfutility.audio

Best Java code snippets using com.netflix.imfutility.audio (Showing top 20 results out of 315)

origin: DSRCorporation/imf-conversion

public void prepareContext() throws InvalidAudioChannelAssignmentException {
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
  prepareSoundfieldGroups();
}
origin: DSRCorporation/imf-conversion

@Override
public void prepareContext() {
  prepareChannelsByOrder();
  try {
    super.prepareContext();
    essenceLayoutValid = true;
  } catch (InvalidAudioChannelAssignmentException e) {
    logger.warn("Layout form Essence descriptors set in CPL cannot properly defined. {}", e.getLocalizedMessage());
    essenceLayoutValid = false;
  }
}
origin: DSRCorporation/imf-conversion

private List<Pair<SequenceUUID, Integer>> getChannelsByLayout(FFmpegAudioChannels[] channelsGroup,
                               SoundfieldGroupInfo soundfieldGroup) {
  return Stream.of(channelsGroup)
      .map(soundfieldGroup.getChannelsMap()::get)
      .collect(Collectors.toList());
}
origin: DSRCorporation/imf-conversion

@Test(expected = InvalidAudioChannelAssignmentException.class)
public void checkNoChannelLayout() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(4,
      new FFmpegAudioChannels[][]{
      });
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

public void addChannels(SequenceUUID uuid, FFmpegAudioChannels[] channels)
    throws InvalidAudioChannelAssignmentException {
  for (int i = 0; i < channels.length; i++) {
    FFmpegAudioChannels channel = channels[i];
    if (channelsMap.containsKey(channel)) {
      throw new InvalidAudioChannelAssignmentException("A soundfield group must contain different channels");
    }
    channelsMap.put(channel, ImmutablePair.of(uuid, i + 1));
  }
}
origin: DSRCorporation/imf-conversion

public void addChannels(SequenceUUID uuid, String channels) throws InvalidAudioChannelAssignmentException {
  addChannels(uuid, FFmpegAudioChannels.toFFmpegAudioChannels(channels));
}
origin: DSRCorporation/imf-conversion

private AudioMapType getDefaultAudioMap() {
  AudioMapType audioMap = null;
  logger.warn("No audiomap.xml specified as a command line argument. A default audiomap.xml will be generated.");
  try {
    audioMap = new AudioMapGuesser(contextProvider, audioLayout).guessAudioMap();
  } catch (InvalidAudioChannelAssignmentException e) {
    logger.warn("Could not generate an audiomap based on EssenceDescriptor: " + e.getMessage());
  }
  if (audioMap == null) {
    logger.debug("Generating default audiomap in a natural order...");
    audioMap = generateDefaultXml();
    logger.info("Generated default audiomap in a natural order: OK");
  }
  return audioMap;
}
origin: DSRCorporation/imf-conversion

@Test
public void checkAllResourcesEqualChannelLayout() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(2, 2, 2,
      new FFmpegAudioChannels[][]{
          {FL, FR}, {FL, FR}, {FL, FR}, {FL, FR},
          {FL, FR, FC, LFE, SL, SR}, {FL, FR, FC, LFE, SL, SR}, {FL, FR, FC, LFE, SL, SR}, {FL, FR, FC, LFE, SL, SR}
      });
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

private boolean isGroupUsed(SoundfieldGroupInfo soundfieldGroup) {
  return soundfieldGroup.getChannelsMap().values().stream()
      .noneMatch(this::isChannelUsed);
}
origin: DSRCorporation/imf-conversion

private AudioMapType processR482A() throws InvalidAudioChannelAssignmentException {
  AudioMapType audioMap = new AudioMapType();
  List<SoundfieldGroupInfo> foundStereo = findInputForChannelGroup(STEREO_LAYOUT);
  // use the first found stereo pair
  if (foundStereo.isEmpty()) {
    throw new InvalidAudioChannelAssignmentException(
        String.format("Expected at least one stereo for %s", EBU_R_48_2_A.value()));
  }
  addStereo(audioMap, 1, foundStereo.get(0));
  addStereoSilence(audioMap, 3);
  return audioMap;
}
origin: DSRCorporation/imf-conversion

@Test
public void checkNoAudio() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(0,
      new FFmpegAudioChannels[][]{
      });
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

protected List<SoundfieldGroupInfo> findInputForChannelGroup(FFmpegAudioChannels[] channelsGroup) {
  List<SoundfieldGroupInfo> result = new ArrayList<>();
  for (SoundfieldGroupInfo soundfieldGroupInfo : inputSoundfieldGroups.values()) {
    Set<FFmpegAudioChannels> inputChannels = soundfieldGroupInfo.getChannelsMap().keySet();
    Set<FFmpegAudioChannels> requiredChannels = new HashSet<>(Arrays.asList(channelsGroup));
    if (!inputChannels.equals(requiredChannels)) {
      continue;
    }
    result.add(soundfieldGroupInfo);
  }
  return result;
}
origin: DSRCorporation/imf-conversion

private AudioMapType processR1234B4C() throws InvalidAudioChannelAssignmentException {
  AudioMapType audioMap = new AudioMapType();
  List<SoundfieldGroupInfo> foundStereo = findInputForChannelGroup(STEREO_LAYOUT);
  // we expect one or two stereo
  if (foundStereo.isEmpty() || foundStereo.size() > 2) {
    throw new InvalidAudioChannelAssignmentException(
        String.format("Expected one or two stereo for %s and %s", EBU_R_123_4_B.value(), EBU_R_123_4_C.value()));
  }
  addStereo(audioMap, 1, foundStereo.get(0)); // final stereo
  if (foundStereo.size() == 2) {
    addStereo(audioMap, 3, foundStereo.get(1)); // M&E stereo
  } else {
    addStereoSilence(audioMap, 3);
  }
  return audioMap;
}
origin: DSRCorporation/imf-conversion

@Test(expected = InvalidAudioChannelAssignmentException.class)
public void checkChannelLayoutNotMatchChannelNum() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(4, 1, 1,
      new FFmpegAudioChannels[][]{
          {FL, FR}, {FL, FR}, {FL, FR}, {FL, FR},
      },
      new String[]{},
      new int[]{1, 1, 1, 1},
      new String[]{}
  );
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

public static void add51(AudioMapType audioMapType, int num, SoundfieldGroupInfo fiveOne) {
  for (FFmpegAudioChannels channel : SURROUND_5_1_LAYOUT) {
    audioMapType.getEBUTrack().add(
        createEbuTrack(num, fiveOne.getChannelsMap().get(channel)));
    num++;
  }
}
origin: DSRCorporation/imf-conversion

@Test(expected = InvalidAudioChannelAssignmentException.class)
public void checkAllResourcesSwappedChannelLayout() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(2, 2, 2,
      new FFmpegAudioChannels[][]{
          {FL, FR}, {FR, FL}, {FL, FR}, {FL, FR},
          {FL, FR, FC, LFE, SL, SR}, {SL, SR, FC, LFE, FL, FR}, {LFE, SL, SR, FL, FR, FC,}, {FC, FR, LFE, SL, SR}
      });
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

public static void addStereo(AudioMapType audioMapType, int num, SoundfieldGroupInfo stereo) {
  for (FFmpegAudioChannels channel : STEREO_LAYOUT) {
    audioMapType.getEBUTrack().add(
        createEbuTrack(num, stereo.getChannelsMap().get(channel)));
    num++;
  }
}
origin: DSRCorporation/imf-conversion

@Test(expected = InvalidAudioChannelAssignmentException.class)
public void check_noChannelLayout_forAll() throws Exception {
  TemplateParameterContextProvider contextProvider = AudioUtils.createContext(4,
      new FFmpegAudioChannels[][]{
          {FL, FR, FC, LFE, SL, SR}
      });
  new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
}
origin: DSRCorporation/imf-conversion

protected String getLanguage(SoundfieldGroupInfo info) {
  String lang = null;
  for (ImmutablePair<SequenceUUID, Integer> seqInfos : info.getChannelsMap().values()) {
    SequenceTemplateParameterContext seqContext = contextProvider.getSequenceContext();
    ContextInfo contextInfo = new ContextInfoBuilder()
        .setSequenceType(SequenceType.AUDIO)
        .setSequenceUuid(seqInfos.getLeft())
        .build();
    if (!seqContext.hasSequenceParameter(SequenceContextParameters.LANGUAGE, contextInfo)) {
      return null;
    }
    String nextLang = seqContext.getParameterValue(SequenceContextParameters.LANGUAGE, contextInfo);
    // all sequences from a soundfield group must have the same language!
    if (lang != null && !lang.equals(nextLang)) {
      return null;
    }
    lang = nextLang;
  }
  return lang;
}
origin: DSRCorporation/imf-conversion

  @Test(expected = InvalidAudioChannelAssignmentException.class)
  public void checkAllResourcesDifferentChannelLayout() throws Exception {
    TemplateParameterContextProvider contextProvider = AudioUtils.createContext(2, 2, 2,
        new FFmpegAudioChannels[][]{
            {FL, FR}, {FL}, {FL, FR}, {FL, FR},
            {FL, FR, FC, LFE, SL, SR}, {SL, SR, FC, LFE, FL, FR}, {LFE, SL, SR, FL, FR, FC,}, {FC}
        });

    new AudioLayoutChecker(contextProvider).checkCorrectChannelLayout();
  }
}
com.netflix.imfutility.audio

Most used classes

  • InvalidAudioChannelAssignmentException
    An exception thrown if audio map can not be generated from the essence descriptor.
  • SoundfieldGroupInfo
    A soundfield group as defined by an Essence Descriptor. Maps each channel in a group to an appropria
  • AudioLayoutChecker
    Checks consistency of CPL provided audio essences and descriptor info.
  • SoundfieldGroupHelper
    Provides basic methods for finding and processing audio layouts defined by EssenceDescriptor. Data r
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now