Beispiel #1
0
void CTextProfile::LoadConfigVariables (void)
{
  AddConfigVariables(TextProfileConfigVariables, 
		     NUM_ELEMENTS_IN_ARRAY(TextProfileConfigVariables));
  // eventually will add interface to read each encoder's variables
  AddTextProfileEncoderVariables(this);
}
Beispiel #2
0
void AddFfmpegConfigVariables (CVideoProfile *pConfig)
{
#ifdef HAVE_AVCODECCONTEXT_TIME_BASE
  pConfig->AddConfigVariables(ffmpegEncoderVariables,
			      NUM_ELEMENTS_IN_ARRAY(ffmpegEncoderVariables));
#endif
}
static uint32_t *faac_bitrates_for_samplerate (uint32_t samplerate, 
					       uint8_t chans, 
					       uint32_t *ret_size)
{
  uint32_t *ret = (uint32_t *)malloc(sizeof(bitRateAllValues));

  memcpy(ret, bitRateAllValues, sizeof(bitRateAllValues));
  *ret_size = NUM_ELEMENTS_IN_ARRAY(bitRateAllValues);
  return ret;
}
bool CALSAAudioCapabilities::ProbeDevice()
{
  if (allSampleRateTableSize > NUM_ELEMENTS_IN_ARRAY(m_samplingRates)) {
    error_message("Number of sample rates exceeds audio cap array");
    return false;
  }

  // Open PCM
  snd_pcm_t *pcm_handle;
  snd_pcm_stream_t stream = SND_PCM_STREAM_CAPTURE;
  snd_pcm_hw_params_t *hwparams;
  snd_pcm_hw_params_alloca(&hwparams);
	int err;
  if ((err= snd_pcm_open(&pcm_handle, m_deviceName, stream, SND_PCM_NONBLOCK)) < 0) {
    error_message("Failed to open %s: %s", m_deviceName, snd_strerror(err));
    return false;
  }
  m_canOpen = true;

  if ((err = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) {
    error_message("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
    return false;
  }

  // union of valid sampling rates for MP3 and AAC
  // for all possible sampling rates
  u_int8_t i;
  for (i = 0; i < allSampleRateTableSize; i++) {
    u_int32_t targetRate = allSampleRateTable[i];
    if (snd_pcm_hw_params_test_rate(pcm_handle, hwparams, targetRate, 0) != 0) {
      debug_message("audio device %s doesn't support sampling rate %u",
                    m_deviceName, targetRate);
      continue;
    }
    debug_message("sampling rate %u supported", targetRate);

    // valid sampling rate
    m_samplingRates[m_numSamplingRates++] = targetRate;
  }

  // zero out remaining sampling rate entries
  for (i = m_numSamplingRates; i < allSampleRateTableSize; i++) {
    m_samplingRates[i] = 0;
  }

  snd_pcm_close(pcm_handle);
  return true;
}
#include "mp4live.h"
#include "audio_encoder.h"
#include "mp4av.h"

/*
 * This looks like a fairly bogus set of routines; however, the
 * code makes it really easy to add your own codecs here, include
 * the mp4live library, write your own main, and go.
 * Just add the codecs you want before the call to the base routines
 */
const uint32_t allSampleRateTable[] = {
  7350, 8000, 11025, 12000, 16000, 22050, 
  24000, 32000, 44100, 48000, 64000, 88200, 96000
};
const uint32_t allSampleRateTableSize = NUM_ELEMENTS_IN_ARRAY(allSampleRateTable);

CAudioEncoder* AudioEncoderCreate(const char* encoderName)
{
  // add codecs here
  return AudioEncoderBaseCreate(encoderName);
}

MediaType get_audio_mp4_fileinfo (CLiveConfig *pConfig,
				  bool *mpeg4,
				  bool *isma_compliant,
				  uint8_t *audioProfile,
				  uint8_t **audioConfig,
				  uint32_t *audioConfigLen,
				  uint8_t *mp4_audio_type)
{
Beispiel #6
0
GtkWidget *create_TextFileDialog (bool do_file)
{
    GtkWidget *TextFileDialog;
    GtkWidget *vbox42;
    GtkWidget *hbox105 = NULL;
    GtkWidget *label196 = NULL;
    GtkWidget *FileNameLabel = NULL;
    GtkWidget *LineEntry;
    GtkWidget *hbox111;
    GtkWidget *vbox43;
    GtkWidget *StartButton;
    GtkWidget *alignment32;
    GtkWidget *hbox112;
    GtkWidget *image38;
    GtkWidget *label204;
    GtkWidget *vbox44;
    GtkWidget *vbox45;
    GtkWidget *PrevButton;
    GtkWidget *alignment33;
    GtkWidget *hbox113;
    GtkWidget *image39;
    GtkWidget *label205;
    GtkWidget *label206;
    GtkWidget *vbox46;
    GtkWidget *NextButton;
    GtkWidget *alignment34;
    GtkWidget *hbox114;
    GtkWidget *label207;
    GtkWidget *image40;
    GtkWidget *vbox47;
    GtkWidget *EndButton;
    GtkWidget *alignment35;
    GtkWidget *hbox115;
    GtkWidget *label208;
    GtkWidget *image41;
    GtkWidget *label209;
    GtkWidget *vbox48;
    GtkWidget *SendButton;
    GtkWidget *alignment36;
    GtkWidget *hbox116;
    GtkWidget *label210;
    GtkWidget *image42;
    GtkWidget *statusbar2;
    GtkTooltips *tooltips;

    tooltips = gtk_tooltips_new();

    TextFileDialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(TextFileDialog), _("Text File Transmission"));
    gtk_window_set_position(GTK_WINDOW(TextFileDialog), GTK_WIN_POS_CENTER);

    vbox42 = gtk_vbox_new(FALSE, 13);
    gtk_widget_show(vbox42);
    gtk_container_add(GTK_CONTAINER(TextFileDialog), vbox42);

    if (do_file) {
        hbox105 = gtk_hbox_new(FALSE, 0);
        gtk_widget_show(hbox105);
        gtk_box_pack_start(GTK_BOX(vbox42), hbox105, FALSE, FALSE, 0);

        label196 = gtk_label_new(_("File Name:"));
        gtk_widget_show(label196);
        gtk_box_pack_start(GTK_BOX(hbox105), label196, TRUE, TRUE, 0);
        gtk_misc_set_padding(GTK_MISC(label196), 0, 9);


        FileNameLabel = gtk_label_new("");
        gtk_widget_show(FileNameLabel);
        gtk_box_pack_start(GTK_BOX(hbox105), FileNameLabel, TRUE, TRUE, 0);
    }
    LineEntry = gtk_entry_new();
    gtk_widget_show(LineEntry);
    gtk_box_pack_start(GTK_BOX(vbox42), LineEntry, FALSE, FALSE, 0);

    hbox111 = gtk_hbox_new(FALSE, 0);
    gtk_widget_show(hbox111);
    gtk_box_pack_start(GTK_BOX(vbox42), hbox111, TRUE, TRUE, 0);

    vbox43 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox43);
    gtk_box_pack_start(GTK_BOX(hbox111), vbox43, FALSE, TRUE, 0);

    StartButton = gtk_button_new();
    gtk_widget_show(StartButton);
    gtk_box_pack_start(GTK_BOX(vbox43), StartButton, TRUE, FALSE, 0);
    gtk_tooltips_set_tip(tooltips, StartButton, _("Move to beginning of file"), NULL);

    alignment32 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment32);
    gtk_container_add(GTK_CONTAINER(StartButton), alignment32);

    hbox112 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox112);
    gtk_container_add(GTK_CONTAINER(alignment32), hbox112);

    image38 = gtk_image_new_from_stock("gtk-goto-first", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image38);
    gtk_box_pack_start(GTK_BOX(hbox112), image38, FALSE, FALSE, 0);

    label204 = gtk_label_new_with_mnemonic(_("Start"));
    gtk_widget_show(label204);
    gtk_box_pack_start(GTK_BOX(hbox112), label204, FALSE, FALSE, 0);

    vbox44 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox44);
    gtk_box_pack_start(GTK_BOX(hbox111), vbox44, FALSE, TRUE, 0);

    vbox45 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox45);
    gtk_box_pack_start(GTK_BOX(vbox44), vbox45, TRUE, FALSE, 0);

    PrevButton = gtk_button_new();
    gtk_widget_show(PrevButton);
    gtk_box_pack_start(GTK_BOX(vbox45), PrevButton, TRUE, FALSE, 0);
    gtk_tooltips_set_tip(tooltips, PrevButton, _("Move to previous entry"), NULL);

    alignment33 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment33);
    gtk_container_add(GTK_CONTAINER(PrevButton), alignment33);

    hbox113 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox113);
    gtk_container_add(GTK_CONTAINER(alignment33), hbox113);

    image39 = gtk_image_new_from_stock("gtk-go-back", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image39);
    gtk_box_pack_start(GTK_BOX(hbox113), image39, FALSE, FALSE, 0);

    label205 = gtk_label_new_with_mnemonic(_("Previous"));
    gtk_widget_show(label205);
    gtk_box_pack_start(GTK_BOX(hbox113), label205, FALSE, FALSE, 0);

    label206 = gtk_label_new("");
    gtk_widget_show(label206);
    gtk_box_pack_start(GTK_BOX(hbox111), label206, TRUE, TRUE, 11);

    vbox46 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox46);
    gtk_box_pack_start(GTK_BOX(hbox111), vbox46, TRUE, TRUE, 0);

    NextButton = gtk_button_new();
    gtk_widget_show(NextButton);
    gtk_box_pack_start(GTK_BOX(vbox46), NextButton, TRUE, FALSE, 0);
    gtk_tooltips_set_tip(tooltips, NextButton, _("Move to next entry"), NULL);

    alignment34 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment34);
    gtk_container_add(GTK_CONTAINER(NextButton), alignment34);

    hbox114 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox114);
    gtk_container_add(GTK_CONTAINER(alignment34), hbox114);

    label207 = gtk_label_new_with_mnemonic(_("Next"));
    gtk_widget_show(label207);
    gtk_box_pack_start(GTK_BOX(hbox114), label207, FALSE, FALSE, 0);

    image40 = gtk_image_new_from_stock("gtk-go-forward", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image40);
    gtk_box_pack_start(GTK_BOX(hbox114), image40, FALSE, FALSE, 0);

    vbox47 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox47);
    gtk_box_pack_start(GTK_BOX(hbox111), vbox47, TRUE, TRUE, 0);

    EndButton = gtk_button_new();
    gtk_widget_show(EndButton);
    gtk_box_pack_start(GTK_BOX(vbox47), EndButton, TRUE, FALSE, 0);
    gtk_tooltips_set_tip(tooltips, EndButton, _("Move to last entry in file"), NULL);

    alignment35 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment35);
    gtk_container_add(GTK_CONTAINER(EndButton), alignment35);

    hbox115 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox115);
    gtk_container_add(GTK_CONTAINER(alignment35), hbox115);

    label208 = gtk_label_new_with_mnemonic(_("End"));
    gtk_widget_show(label208);
    gtk_box_pack_start(GTK_BOX(hbox115), label208, FALSE, FALSE, 0);

    image41 = gtk_image_new_from_stock("gtk-goto-last", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image41);
    gtk_box_pack_start(GTK_BOX(hbox115), image41, FALSE, FALSE, 0);

    label209 = gtk_label_new("");
    gtk_widget_show(label209);
    gtk_box_pack_start(GTK_BOX(hbox111), label209, TRUE, TRUE, 26);

    vbox48 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox48);
    gtk_box_pack_start(GTK_BOX(hbox111), vbox48, TRUE, FALSE, 0);

    SendButton = gtk_button_new();
    gtk_widget_show(SendButton);
    gtk_box_pack_start(GTK_BOX(vbox48), SendButton, TRUE, FALSE, 0);
    gtk_tooltips_set_tip(tooltips, SendButton, _("Transmit file"), NULL);

    alignment36 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment36);
    gtk_container_add(GTK_CONTAINER(SendButton), alignment36);

    hbox116 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox116);
    gtk_container_add(GTK_CONTAINER(alignment36), hbox116);

    label210 = gtk_label_new_with_mnemonic(_("Send"));
    gtk_widget_show(label210);
    gtk_box_pack_start(GTK_BOX(hbox116), label210, FALSE, FALSE, 0);

    image42 = gtk_image_new_from_stock("gtk-ok", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image42);
    gtk_box_pack_start(GTK_BOX(hbox116), image42, FALSE, FALSE, 0);

    statusbar2 = gtk_statusbar_new ();
    gtk_widget_show (statusbar2);
    gtk_box_pack_start (GTK_BOX (vbox42), statusbar2, FALSE, FALSE, 0);

    g_signal_connect((gpointer) TextFileDialog, "delete_event",
                     G_CALLBACK(on_TextFileDialog_delete_event),
                     NULL);
    g_signal_connect((gpointer) TextFileDialog, "destroy",
                     G_CALLBACK(on_TextFileDialog_destroy),
                     NULL);
    if (do_file) {
        g_signal_connect((gpointer) StartButton, "clicked",
                         G_CALLBACK(on_StartButton_clicked),
                         TextFileDialog);
        g_signal_connect((gpointer) PrevButton, "clicked",
                         G_CALLBACK(on_PrevButton_clicked),
                         TextFileDialog);
        g_signal_connect((gpointer) NextButton, "clicked",
                         G_CALLBACK(on_NextButton_clicked),
                         TextFileDialog);
        g_signal_connect((gpointer) EndButton, "clicked",
                         G_CALLBACK(on_EndButton_clicked),
                         TextFileDialog);
    }
    g_signal_connect((gpointer) SendButton, "clicked",
                     G_CALLBACK(on_SendButton_clicked),
                     TextFileDialog);
    g_signal_connect((gpointer)LineEntry, "activate",
                     G_CALLBACK(on_LineEntry_activate),
                     TextFileDialog);

    /* Store pointers to all widgets, for use by lookup_widget(). */
    GLADE_HOOKUP_OBJECT_NO_REF(TextFileDialog, TextFileDialog, "TextFileDialog");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox42, "vbox42");
    if (hbox105 != NULL) {
        GLADE_HOOKUP_OBJECT(TextFileDialog, hbox105, "hbox105");
        GLADE_HOOKUP_OBJECT(TextFileDialog, label196, "label196");
        GLADE_HOOKUP_OBJECT(TextFileDialog, FileNameLabel, "FileNameLabel");
    }
    GLADE_HOOKUP_OBJECT(TextFileDialog, LineEntry, "LineEntry");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox111, "hbox111");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox43, "vbox43");
    GLADE_HOOKUP_OBJECT(TextFileDialog, StartButton, "StartButton");
    GLADE_HOOKUP_OBJECT(TextFileDialog, alignment32, "alignment32");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox112, "hbox112");
    GLADE_HOOKUP_OBJECT(TextFileDialog, image38, "image38");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label204, "label204");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox44, "vbox44");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox45, "vbox45");
    GLADE_HOOKUP_OBJECT(TextFileDialog, PrevButton, "PrevButton");
    GLADE_HOOKUP_OBJECT(TextFileDialog, alignment33, "alignment33");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox113, "hbox113");
    GLADE_HOOKUP_OBJECT(TextFileDialog, image39, "image39");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label205, "label205");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label206, "label206");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox46, "vbox46");
    GLADE_HOOKUP_OBJECT(TextFileDialog, NextButton, "NextButton");
    GLADE_HOOKUP_OBJECT(TextFileDialog, alignment34, "alignment34");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox114, "hbox114");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label207, "label207");
    GLADE_HOOKUP_OBJECT(TextFileDialog, image40, "image40");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox47, "vbox47");
    GLADE_HOOKUP_OBJECT(TextFileDialog, EndButton, "EndButton");
    GLADE_HOOKUP_OBJECT(TextFileDialog, alignment35, "alignment35");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox115, "hbox115");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label208, "label208");
    GLADE_HOOKUP_OBJECT(TextFileDialog, image41, "image41");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label209, "label209");
    GLADE_HOOKUP_OBJECT(TextFileDialog, vbox48, "vbox48");
    GLADE_HOOKUP_OBJECT(TextFileDialog, SendButton, "SendButton");
    GLADE_HOOKUP_OBJECT(TextFileDialog, alignment36, "alignment36");
    GLADE_HOOKUP_OBJECT(TextFileDialog, hbox116, "hbox116");
    GLADE_HOOKUP_OBJECT(TextFileDialog, label210, "label210");
    GLADE_HOOKUP_OBJECT(TextFileDialog, image42, "image42");
    GLADE_HOOKUP_OBJECT_NO_REF(TextFileDialog, tooltips, "tooltips");
    GLADE_HOOKUP_OBJECT (TextFileDialog, statusbar2, "statusbar2");

    if (do_file) {
        text_file_data_t *tptr = MALLOC_STRUCTURE(text_file_data_t);
        memset(tptr, 0, sizeof(*tptr));
        const char *fname =
            MyConfig->GetStringValue(CONFIG_TEXT_SOURCE_FILE_NAME);

        tptr->m_file = fopen(fname, "r");
        if (tptr->m_file == NULL) {
            char buffer[PATH_MAX];
            snprintf(buffer, PATH_MAX, "Can't open file %s", fname);
            ShowMessage("Can't open file",buffer);
            gtk_widget_destroy(TextFileDialog);
            return NULL;
        }
        gtk_label_set_text(GTK_LABEL(FileNameLabel), fname);
        ReadNextLine(tptr);
        DisplayLineInBuffer(TextFileDialog, tptr);
        GLADE_HOOKUP_OBJECT_NO_REF(TextFileDialog, tptr, "TextFileData");
    } else {
        gtk_widget_set_sensitive(StartButton, false);
        gtk_widget_set_sensitive(PrevButton, false);
        gtk_widget_set_sensitive(NextButton, false);
        gtk_widget_set_sensitive(EndButton, false);
        GLADE_HOOKUP_OBJECT_NO_REF(TextFileDialog, NULL, "TextFileData");
    }

    gtk_drag_dest_set(TextFileDialog,
                      GTK_DEST_DEFAULT_ALL,
                      drop_types,
                      NUM_ELEMENTS_IN_ARRAY(drop_types),
                      GDK_ACTION_COPY);
    gtk_drag_dest_set(LineEntry,
                      GTK_DEST_DEFAULT_ALL,
                      drop_types,
                      NUM_ELEMENTS_IN_ARRAY(drop_types),
                      GDK_ACTION_COPY);

    g_signal_connect((gpointer)TextFileDialog, "drag_data_received",
                     G_CALLBACK(on_drag_data_received),
                     TextFileDialog);

    g_signal_connect((gpointer)LineEntry, "drag_data_received",
                     G_CALLBACK(on_drag_data_received_entry),
                     TextFileDialog);

    gtk_widget_show(TextFileDialog);

    if (do_file) {
        gtk_widget_grab_focus(SendButton);
        on_SendButton_clicked(GTK_BUTTON(SendButton), TextFileDialog);
    } else {
        gtk_widget_grab_focus(LineEntry);
    }
    return TextFileDialog;
}
Beispiel #7
0
void AddTextProfileEncoderVariables (CTextProfile *pConfig)
{
  pConfig->AddConfigVariables(hrefEncoderVariables, 
			      NUM_ELEMENTS_IN_ARRAY(hrefEncoderVariables));
}
Beispiel #8
0
			      NUM_ELEMENTS_IN_ARRAY(hrefEncoderVariables));
}

//#define DEBUG_TEXT
text_encoder_table_t text_encoder_table[] = {
  { "Plain Text",
    TEXT_ENCODING_PLAIN,
    NULL,
  },
  { "ISMA Href",
    TEXT_ENCODING_HREF,
    TABLE_FUNC(href_gui_options),
  }
};

uint32_t text_encoder_table_size = NUM_ELEMENTS_IN_ARRAY(text_encoder_table);

class CPlainTextEncoder : public CTextEncoder 
{
 public:
  CPlainTextEncoder(CTextProfile *profile, uint16_t mtu, CTextEncoder *next, 
		    bool realTime = true) :
    CTextEncoder(profile, mtu, next, realTime) { };
  bool Init(void) { 
    m_encodedFrame = NULL;
    return true; 
  };
  MediaType GetFrameType(void) { return PLAINTEXTFRAME; };
 protected:
  void StopEncoder(void) {
    CHECK_AND_FREE(m_encodedFrame);
Beispiel #9
0
void AddX264ConfigVariables (CVideoProfile *pConfig)
{
  pConfig->AddConfigVariables(X264EncoderVariables,
			      NUM_ELEMENTS_IN_ARRAY(X264EncoderVariables));
}
Beispiel #10
0
void CAudioProfile::LoadConfigVariables (void)
{
  AddConfigVariables(AudioProfileConfigVariables, 
		     NUM_ELEMENTS_IN_ARRAY(AudioProfileConfigVariables));
  // eventually will add interface to read each encoder's variables
}
}

GUI_BOOL(gui_rfc3016, CFG_RTP_RFC3016, "Transmit AAC using RFC-3016 (LATM - for 3gp)");

DECLARE_TABLE(faac_gui_options) = {
  TABLE_GUI(gui_rfc3016),
};

DECLARE_TABLE_FUNC(faac_gui_options);

audio_encoder_table_t faac_audio_encoder_table = {
  "AAC - FAAC", 
  AUDIO_ENCODER_FAAC,
  AUDIO_ENCODING_AAC,
  samplingRateAllValues,
  NUM_ELEMENTS_IN_ARRAY(samplingRateAllValues),
  faac_bitrates_for_samplerate,
  2,
  TABLE_FUNC(faac_gui_options)
};

MediaType faac_mp4_fileinfo (CAudioProfile *pConfig,
			     bool *mpeg4,
			     bool *isma_compliant,
			     uint8_t *audioProfile,
			     uint8_t **audioConfig,
			     uint32_t *audioConfigLen,
			     uint8_t *mp4AudioType)
{
  *mpeg4 = true;
  if(pConfig->GetBoolValue(CFG_RTP_RFC3016)) {
Beispiel #12
0
static char* PrintAudioInfo(
	MP4FileHandle mp4File,
	MP4TrackId trackId)
{
	static const char* mpeg4AudioNames[] = {
		"MPEG-4 AAC main",
		"MPEG-4 AAC LC",
		"MPEG-4 AAC SSR",
		"MPEG-4 AAC LTP",
		"MPEG-4 AAC HE",
		"MPEG-4 AAC Scalable",
		"MPEG-4 TwinVQ",
		"MPEG-4 CELP",
		"MPEG-4 HVXC",
		NULL, NULL,
		"MPEG-4 TTSI",
		"MPEG-4 Main Synthetic",
		"MPEG-4 Wavetable Syn",
		"MPEG-4 General MIDI",
		"MPEG-4 Algo Syn and Audio FX",
		"MPEG-4 ER AAC LC",
		NULL,
		"MPEG-4 ER AAC LTP",
		"MPEG-4 ER AAC Scalable",
		"MPEG-4 ER TwinVQ",
		"MPEG-4 ER BSAC",
		"MPEG-4 ER ACC LD",
		"MPEG-4 ER CELP",
		"MPEG-4 ER HVXC",
		"MPEG-4 ER HILN",
		"MPEG-4 ER Parametric",
		"MPEG-4 SSC",
		"MPEG-4 PS",
		"MPEG-4 MPEG Surround",
		NULL,
		"MPEG-4 Layer-1",
		"MPEG-4 Layer-2",
		"MPEG-4 Layer-3",
		"MPEG-4 DST",
		"MPEG-4 Audio Lossless",
		"MPEG-4 SLS",
		"MPEG-4 SLS non-core", 
	};

	static const u_int8_t mpegAudioTypes[] = {
		MP4_MPEG2_AAC_MAIN_AUDIO_TYPE,	// 0x66
		MP4_MPEG2_AAC_LC_AUDIO_TYPE,	// 0x67
		MP4_MPEG2_AAC_SSR_AUDIO_TYPE,	// 0x68
		MP4_MPEG2_AUDIO_TYPE,			// 0x69
		MP4_MPEG1_AUDIO_TYPE,			// 0x6B
		// private types
		MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE,
		MP4_VORBIS_AUDIO_TYPE,
		MP4_ALAW_AUDIO_TYPE,
		MP4_ULAW_AUDIO_TYPE,
		MP4_G723_AUDIO_TYPE,
		MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE,
	};
	static const char* mpegAudioNames[] = {
		"MPEG-2 AAC Main",
		"MPEG-2 AAC LC",
		"MPEG-2 AAC SSR",
		"MPEG-2 Audio (13818-3)",
		"MPEG-1 Audio (11172-3)",
		// private types
		"PCM16 (little endian)",
		"Vorbis",
		"G.711 aLaw",
		"G.711 uLaw",
		"G.723.1",
		"PCM16 (big endian)",
	};
	u_int8_t numMpegAudioTypes =
		sizeof(mpegAudioTypes) / sizeof(u_int8_t);

	const char* typeName = "Unknown";
	bool foundType = false;
	u_int8_t type = 0;
	const char *media_data_name;

	media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);

	if (media_data_name == NULL) {
	  typeName = "Unknown - no media data name";
	} else if (strcasecmp(media_data_name, "samr") == 0) {
	    typeName = "AMR";
	    foundType = true;
	} else if (strcasecmp(media_data_name, "sawb") == 0) {
	    typeName = "AMR-WB";
	    foundType = true;
	} else if (strcasecmp(media_data_name, "mp4a") == 0) {
	    
	  type = MP4GetTrackEsdsObjectTypeId(mp4File, trackId);
	  switch (type) {
	  case MP4_INVALID_AUDIO_TYPE:
	    typeName = "AAC from .mov";
	    foundType = true;
	    break;
	  case MP4_MPEG4_AUDIO_TYPE:  {
	
	    type = MP4GetTrackAudioMpeg4Type(mp4File, trackId);
	    if (type == MP4_MPEG4_INVALID_AUDIO_TYPE ||
		type > NUM_ELEMENTS_IN_ARRAY(mpeg4AudioNames) || 
		mpeg4AudioNames[type - 1] == NULL) {
	      typeName = "MPEG-4 Unknown Profile";
	    } else {
	      typeName = mpeg4AudioNames[type - 1];
	      foundType = true;
	    }
	    break;
	  }
	    // fall through
	  default:
	    for (u_int8_t i = 0; i < numMpegAudioTypes; i++) {
	      if (type == mpegAudioTypes[i]) {
		typeName = mpegAudioNames[i];
		foundType = true;
		break;
	      }
	    }
	  }
	} else {
	  typeName = media_data_name;
	  foundType = true;
	}

	u_int32_t timeScale =
		MP4GetTrackTimeScale(mp4File, trackId);

	MP4Duration trackDuration =
		MP4GetTrackDuration(mp4File, trackId);

	double msDuration =
		UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId,
			trackDuration, MP4_MSECS_TIME_SCALE));

	u_int32_t avgBitRate =
		MP4GetTrackBitRate(mp4File, trackId);

	char *sInfo = (char*)MP4Malloc(256);

	// type duration avgBitrate samplingFrequency
	if (foundType)
	  snprintf(sInfo, 256, 
		  "%u\taudio\t%s%s, %.3f secs, %u kbps, %u Hz\n",
		  trackId,
		  MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "",
		  typeName,
		  msDuration / 1000.0,
		  (avgBitRate + 500) / 1000,
		  timeScale);
	else
	  snprintf(sInfo, 256,
		  "%u\taudio\t%s%s(%u), %.3f secs, %u kbps, %u Hz\n",
		  trackId,
		  MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "",
		  typeName,
		  type,
		  msDuration / 1000.0,
		  (avgBitRate + 500) / 1000,
		  timeScale);

	return sInfo;
}
void CMediaStream::LoadConfigVariables (void)
{
  AddConfigVariables(StreamConfigVariables, 
		     NUM_ELEMENTS_IN_ARRAY(StreamConfigVariables));
}