//////////////////////////////////////////////////////////////////////////////// // virtual std::string LLMediaImplGStreamer::getVersion() { guint major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano); return version; }
AudioTestSource_i::AudioTestSource_i(const char *uuid, const char *label) : AudioTestSource_base(uuid, label), pipeline(0), bus(0), src(0), conv(0), resamp(0), sink(0) { // Initialize and determine which version of GStreamer is being used. const gchar *nano_str; guint major, minor, micro, nano; gst_init(0, 0); gst_version (&major, &minor, µ, &nano); if (nano == 1) { nano_str = "(CVS)"; } else if (nano == 2) { nano_str = "(Prerelease)"; } else { nano_str = ""; } LOG_DEBUG(AudioTestSource_i, "Using GStreamer " << major << "." << minor << "." << micro << " " << nano_str); }
void GstPipelineWrapper::EnsureGstreamerInitialization() { if (!gst_is_initialized()) { // int argc = 0; // char** argv = NULL; int argc = 0; char **argv = new char *[2]; argv[argc++] = "--gst-version"; argv[argc++] = "--gst-debug-level=1"; gst_init(&argc, &argv); delete argv; // get and display GST version { guint major = 0; guint minor = 0; guint micro = 0; guint nano = 0; gst_version(&major,&minor,µ,&nano); std::cout << "GStreamer V" << major << "." << minor << "." << micro << "." << nano << std::endl; } } }
cPlayback::cPlayback(int num) { lt_info( "%s:%s\n", FILENAME, __FUNCTION__); const gchar *nano_str; guint major, minor, micro, nano; gst_init(NULL, NULL); gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; lt_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", FILENAME, __FUNCTION__, major, minor, micro, nano_str); mAudioStream = 0; mSpeed = 0; playing = false; playstate = STATE_STOP; }
std::string MediaHandlerGst::description() const { guint major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); std::ostringstream s; s << "Gstreamer " << major << "." << minor << "." << micro; return s.str(); }
int main(int argc, char** argv) { // Options parser GOptionContext* ctx = g_option_context_new("streamplay"); const gchar** remaining_args = NULL; GOptionEntry entries[] = { { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, "FILE" }, { NULL, '\0', 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; g_option_context_add_main_entries(ctx, entries, NULL); g_option_context_add_group(ctx, gst_init_get_option_group() ); GError* err = NULL; if(!g_option_context_parse(ctx, &argc, &argv, &err)) { std::cerr << "Argument error:" << err->message << std::endl; g_error_free(err); return 1; } if(! remaining_args) { // Missing url argument std::cerr << "Usage: [uri]" << std::endl; return 1; } const gchar* uri = remaining_args[0]; // GStreamer version info guint major, minor, micro, nano; gst_init(&argc, &argv); gst_version(&major, &minor, µ, &nano); const gchar *nano_str = ""; switch(nano) { case 1: nano_str = "(CVS)"; break; case 2: nano_str = "(Prerelease)"; break; } std::cout << "Using GStreamer " << major << "." << minor << "." << micro << " " << nano_str << std::endl; // Start main loop { loop = g_main_loop_new(NULL, FALSE); InternetRadio radio(uri, loop); g_main_loop_run(loop); } g_main_loop_unref(loop); return 0; }
gchar * gst_version_string (void) { guint major, minor, micro, nano; gst_version (&major, &minor, µ, &nano); if (nano == 0) return g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro); else if (nano == 1) return g_strdup_printf ("GStreamer %d.%d.%d (GIT)", major, minor, micro); else return g_strdup_printf ("GStreamer %d.%d.%d (prerelease)", major, minor, micro); }
void gstreamer_init(int *argcp, char **argvp[]) { gst_init(argcp, argvp); guint major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); if (major != GST_VERSION_MAJOR) { printf("Error: gstreamer API major version is not %d (version %d.%d found).\n", GST_VERSION_MAJOR, major, minor); exit(1); } if (minor != GST_VERSION_MINOR) { printf("Warning: gstreamer API version is not %d.%d (version %d.%d found).\n", GST_VERSION_MAJOR, GST_VERSION_MINOR, major, minor); } }
void Gst_Test::print_gst_version() { const gchar *nano_str; guint major, minor, micro, nano; gst_init (NULL, NULL); gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; printf ("This program is linked against GStreamer %d.%d.%d %s\n", major, minor, micro, nano_str); return; }
int main(int argc, char *argv[]) { guint major, minor, micro, nano; printf("%s build : %s %s\n", argv[0], __DATE__, __TIME__); //gst_init(&argc, &argv); gst_init(NULL, NULL); gst_version(&major, &minor, µ, &nano); printf("GStreamer version %d.%d.%d.%d\n", major, minor, micro, nano); printf("GStreamer version %d.%d.%d.%d\n", GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO, GST_VERSION_NANO); return 0; }
CAMLprim value ocaml_gstreamer_version(value unit) { CAMLparam0(); CAMLlocal1(ans); unsigned int major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); ans = caml_alloc_tuple(4); Store_field(ans,0,Val_int(major)); Store_field(ans,1,Val_int(minor)); Store_field(ans,2,Val_int(micro)); Store_field(ans,3,Val_int(nano)); CAMLreturn(ans); }
std::string MediaPluginGStreamer010::getVersion() { std::string plugin_version = "GStreamer010 media plugin, GStreamer version "; if (mDoneInit) // && gst_version) { guint major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); plugin_version += llformat("%u.%u.%u.%u (runtime), %u.%u.%u.%u (headers)", (unsigned int)major, (unsigned int)minor, (unsigned int)micro, (unsigned int)nano, (unsigned int)GST_VERSION_MAJOR, (unsigned int)GST_VERSION_MINOR, (unsigned int)GST_VERSION_MICRO, (unsigned int)GST_VERSION_NANO); } else { plugin_version += "(unknown)"; } return plugin_version; }
int main (int argc,char *argv[]) { const gchar *nano_str; guint major, minor, micro, nano; gst_init (&argc, &argv); gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; printf ("This program is linked against GStreamer %d.%d.%d %s\n", major, minor, micro, nano_str); return 0; }
int main(int argc, char ** argv) { const gchar * nano_str; guint major, minor, micro, nano; gst_init(&argc, &argv); gst_version(&major, &minor, µ, &nano); if(nano==1) nano_str = "(CVS)"; else if (nano==2) nano_str = "(Prerelease)"; else nano_str = ""; std::cout << "This program is linked against GStreamer " <<major<<"."<<minor<<"."<<micro<<" "<<nano_str<<std::endl; return 0; }
void ConnectionProvider::InitializeGStreamer() { std::string fs_plugin_path = Poco::Path::current(); fs_plugin_path.append("gstreamer\\lib\\farsight2-0.0"); Poco::Environment::set("FS_PLUGIN_PATH", fs_plugin_path); QString gst_plugin_path = QString(Poco::Path::current().c_str()).append("gstreamer\\lib\\gstreamer-0.10"); Poco::Environment::set("GST_PLUGIN_PATH", gst_plugin_path.toStdString().c_str()); const int ARGC = 5; QString arg_gst_plugin_path(QString("--gst-plugin-path=").append(gst_plugin_path).append("")); QString arg_gst_disable_registry_update("--gst-disable-registry-update"); QString arg_gst_disable_registry_fork("--gst-disable-registry-fork"); int argc = ARGC; char* argv[ARGC]; std::string args[ARGC]; args[0] = ""; // first argument will be ignored args[1] = arg_gst_plugin_path.toStdString(); args[2] = ""; //arg_gst_disable_registry_update.toStdString(); args[3] = arg_gst_disable_registry_fork.toStdString(); args[4] = ""; // "--gst-debug-level=3"; //arg_gst_disable_registry_fork.toStdString(); for (int i=0; i < ARGC; ++i) { argv[i] = (char*)args[i].c_str(); QString message = QString("gstreamer init arg: ").append(QString(args[i].c_str())); LogDebug(message.toStdString()); } char** p_argv = &argv[0]; GError error; GError *p_error = &error; if (!gst_init_check(&argc, &p_argv, &p_error)) { QString error_message("Cannot initialize GStreamer: "); error_message.append(p_error->message); LogError(error_message.toStdString()); return; } guint major, minor, micro, nano; gst_version (&major, &minor, µ, &nano); QString text; text.sprintf("GStreamer version %i.%i.%i.%i initialized.", major, minor, micro, nano); LogInfo(text.toStdString()); }
// ---------------------------------------------------------------------------- // Instantiate GStreamerImportPlugin and add to the list of known importers void GetGStreamerImportPlugin(ImportPluginList *importPluginList, UnusableImportPluginList * WXUNUSED(unusableImportPluginList)) { wxLogMessage(wxT("Audacity is built against GStreamer version %d.%d.%d-%d"), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO, GST_VERSION_NANO); // Initializa gstreamer GError *error; int argc = 0; char **argv = NULL; if (!gst_init_check(&argc, &argv, &error)) { wxLogMessage(wxT("Failed to initialize GStreamer. Error %d: %s"), error->code, wxString::FromUTF8(error->message).c_str()); g_error_free(error); return; } guint major, minor, micro, nano; gst_version(&major, &minor, µ, &nano); wxLogMessage(wxT("Linked to GStreamer version %d.%d.%d-%d"), major, minor, micro, nano); // Instantiate plugin GStreamerImportPlugin *plug = new GStreamerImportPlugin(); // No supported extensions...no gstreamer plugins installed if (plug->GetSupportedExtensions().GetCount() == 0) { delete plug; return; } // Add to list of importers importPluginList->Append(plug); }
static void print_version_info () { guint major, minor, micro, nano; const gchar *nano_str; gst_version (&major, &minor, µ, &nano); if (nano == 1) { nano_str = "(git)"; } else if (nano == 2) { nano_str = "(Prerelease)"; } else { nano_str = ""; } g_print ("gstreamill version: %s\n", VERSION); g_print ("gstreamill build: %s %s\n", __DATE__, __TIME__); g_print ("gstreamer version : %d.%d.%d %s\n", major, minor, micro, nano_str); }
// 'Main program' equivalent: the program execution "starts" here bool moDirectorApp::OnInit() { //(*AppInitialize bool wxsOK = true; //*) wxInitAllImageHandlers(); // Check next line: Gustavo 05/20/2009 // return wxsOK; guint major, minor, micro, nano; cout << "Gstreamer initializing..." << endl; gst_init(NULL,NULL); gst_version (&major, &minor, µ, &nano); cout << "Gstreamer initialized" << " version: " << major << "." << minor << "." << micro << "." << nano << endl; //** SET WORKING PATH CORRECTLY **/ #if wxMAJOR_VERSION<3 wxStandardPaths StdPaths; #else wxStandardPaths StdPaths = wxStandardPaths::Get(); #endif wxFileName exename(StdPaths.GetExecutablePath()); exename.MakeAbsolute(); //wxMessageBox(wxString("appdir:")+wxString(exename.GetPath())); wxSetWorkingDirectory( wxString(exename.GetPath()) ); //** EVERYTHING OK!!!**// moDirectorCore* m_pDirectorCore = NULL; moDirectorFrame* m_pDirectorFrame = NULL; SetAppName(wxString(_("Moldeo Director ")) + moText2Wx(moGetVersionStr()) ); // Check only one instance running m_checker = NULL; /* const wxString name = wxString::Format(wxT("MoldeoDirector-%s"), wxGetUserId().c_str()); // Use mb_str() m_checker = new wxSingleInstanceChecker(name); if (m_checker->IsAnotherRunning()) { wxLogError(_("Program already running, aborting.")); return false; } */ // Check configuration file /* wxString str; wxFileConfig configuration(wxT("MoldeoDirector"),wxT("Moldeo"),wxT(wxGetCwd())); configuration.Read(wxT("General/File1"), &str); wxMessageBox(wxT(str),wxT("Moldeo Director")); */ // created initially) cout << "Image Handlers..." << endl; #if wxUSE_SYSTEM_OPTIONS //wxSystemOptions::SetOption(wxT("no-maskblt"), 1); #endif wxInitAllImageHandlers(); #if wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS //wxFileSystem::AddHandler(new wxInternetFSHandler); #endif wxImageHandler* hndPNG = wxImage::FindHandler((long)wxBITMAP_TYPE_PNG); if (!hndPNG) cout << "Warning: PNG Image handler not loaded..." << endl; wxImageHandler* hndJPEG = wxImage::FindHandler((long)wxBITMAP_TYPE_JPEG); if (!hndJPEG) cout << "Warning: JPEG Image handler not loaded..." << endl; wxImageHandler* hndTGA = wxImage::FindHandler((long)wxBITMAP_TYPE_TGA); if (!hndTGA) cout << "Warning: TGA Image handler not loaded..." << endl; // create the main application window cout << "Director Frame..." << endl; m_pDirectorFrame = new moDirectorFrame(wxString(_("Moldeo Director ")) + moText2Wx(moGetVersionStr())); if (m_pDirectorFrame) { m_pDirectorFrame->SetIcon( wxIcon( wxIconLocation(wxT(MOLDEODATADIR "/icons/Moldeo32.ico")) ) ); m_pDirectorFrame->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); m_pDirectorFrame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); } else { exit(1); } cout << "m_pDirectorFrame:" << (m_pDirectorFrame!=NULL) << endl; cout << "Director Core..." << endl; m_pDirectorCore = new moDirectorCore(); cout << "m_pDirectorCore:" << (m_pDirectorCore!=NULL) << endl; cout << "Director Frame UI to Core..." << endl; m_pDirectorCore->SetUserInterface( m_pDirectorFrame ); m_pDirectorCore->SetPaths( moWx2Text(exename.GetPath()), moWx2Text(StdPaths.GetUserDataDir()), moWx2Text(wxString(wxT(MODULESDIR))), moWx2Text(wxString(wxT(MOLDEODATADIR))) ); m_pDirectorCore->Init(); //wxList ImageHandlerList = wxImage::GetHandlers(); cout << "appdir:" << moWx2Text( wxGetCwd() ) << endl; cout << "userdir:" << moWx2Text( StdPaths.GetUserDataDir() ) << endl; cout << "datadir:" << moWx2Text(wxString(_(MOLDEODATADIR))) << endl; cout << "modulesdir:" << moWx2Text(wxString(_(MODULESDIR))) << endl; cout << "Showing Frame..." << endl; m_pDirectorFrame->Show(true); cout << "Setting Top Window..." << endl; SetTopWindow(m_pDirectorFrame); m_pDirectorFrame->Maximize(); m_pDirectorFrame->Init(); cout << "Success!!! rock and roll!!" << endl; moText config; cout << "argc: " << argc << endl; /*minimo 2*/ while( argc >= 2 ) { --argc; wxString arglast(argv[argc]); wxString argprev; if (argc>0) argprev = argv[argc-1]; wxString arg0(argv[0]); cout << "Argument id" << (argc) << " : " << moWx2Text(arglast) << endl; if( argprev == wxString( _("-mol") ) ) { config = moWx2Text( arglast ); cout << "Argument -mol found! : " << config << endl; --argc; } else if ( arglast == wxString(_("--help")) ) { cout << "Usage: " << moWx2Text(arg0) << " [-mol]" << endl; } else { cout << "Usage: " << moWx2Text(arg0) << " [-mol]" << endl; /*wxMessageBox( wxString(wxT("Error opening:")) + wxString(wxT(" argc:")) + // wxString(IntToStr(argc)) + wxString(wxT(" argv[argc-1]:")) + argv[argc-1] + wxString(wxT(" argv[0]:")) + wxString(argv[0]) + wxString(wxT(" argv[1]:")) + wxString(argv[1]) + wxString(wxT(" argv[2]:")) + wxString(argv[2]) ); */ //exit(0); } } if (config!=moText("")) { moProjectDescriptor ProjectDescriptor; wxFileName FileName( moText2Wx(config) ); wxString path = FileName.GetPath(); #ifdef MO_WIN32 path+= _T("\\"); #else path+= _T("/"); #endif wxString name = FileName.GetFullName(); ProjectDescriptor.Set( moWx2Text(path), moWx2Text(name) ); moDirectorStatus mStatus = m_pDirectorFrame->OpenProject( ProjectDescriptor ); } // success: wxApp::OnRun() will be called which will enter the main message // loop and the application will run. If we returned false here, the // application would exit immediately. return true; }
static GstFlowReturn gst_mxf_mux_create_metadata (GstMXFMux * mux) { GstFlowReturn ret = GST_FLOW_OK; GSList *l; GArray *tmp; GST_DEBUG_OBJECT (mux, "Creating MXF metadata"); for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; if (!cpad || !cpad->descriptor || !GST_PAD_CAPS (cpad->collect.pad)) return GST_FLOW_ERROR; if (cpad->writer->update_descriptor) cpad->writer->update_descriptor (cpad->descriptor, GST_PAD_CAPS (cpad->collect.pad), cpad->mapping_data, cpad->collect.buffer); } /* Preface */ mux->preface = (MXFMetadataPreface *) gst_mini_object_new (MXF_TYPE_METADATA_PREFACE); mxf_uuid_init (&MXF_METADATA_BASE (mux->preface)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (mux->preface)->instance_uid, mux->preface); mux->metadata_list = g_list_prepend (mux->metadata_list, mux->preface); mxf_timestamp_set_now (&mux->preface->last_modified_date); mux->preface->version = 258; mux->preface->object_model_version = 1; mxf_op_set_generalized (&mux->preface->operational_pattern, MXF_OP_1a, TRUE, TRUE, FALSE); tmp = g_array_new (FALSE, FALSE, sizeof (MXFUL)); for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; guint i; gboolean found = FALSE; if (!cpad || !cpad->descriptor || mxf_ul_is_zero (&cpad->descriptor->essence_container)) return GST_FLOW_ERROR; for (i = 0; i < tmp->len; i++) { if (mxf_ul_is_equal (&cpad->descriptor->essence_container, &g_array_index (tmp, MXFUL, i))) { found = TRUE; break; } } if (found) continue; g_array_append_val (tmp, cpad->descriptor->essence_container); } mux->preface->n_essence_containers = tmp->len; mux->preface->essence_containers = (MXFUL *) g_array_free (tmp, FALSE); /* This will later be used as UID for the material package */ mxf_uuid_init (&mux->preface->primary_package_uid, mux->metadata); /* Identifications */ { MXFMetadataIdentification *identification; static const guint8 gst_uid[] = { 0xe5, 0xde, 0xcd, 0x04, 0x24, 0x90, 0x69, 0x18, 0x8a, 0xc9, 0xb5, 0xd7, 0x02, 0x58, 0x46, 0x78 }; guint major, minor, micro, nano; mux->preface->n_identifications = 1; mux->preface->identifications = g_new0 (MXFMetadataIdentification *, 1); identification = mux->preface->identifications[0] = (MXFMetadataIdentification *) gst_mini_object_new (MXF_TYPE_METADATA_IDENTIFICATION); mxf_uuid_init (&MXF_METADATA_BASE (identification)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (identification)->instance_uid, identification); mux->metadata_list = g_list_prepend (mux->metadata_list, identification); mxf_uuid_init (&identification->this_generation_uid, NULL); identification->company_name = g_strdup ("GStreamer"); identification->product_name = g_strdup ("GStreamer Multimedia Framework"); gst_version (&major, &minor, µ, &nano); identification->product_version.major = major; identification->product_version.minor = minor; identification->product_version.patch = micro; identification->product_version.build = nano; identification->product_version.release = (nano == 0) ? 1 : (nano == 1) ? 2 : 4; identification->version_string = g_strdup_printf ("%u.%u.%u.%u", major, minor, micro, nano); memcpy (&identification->product_uid, &gst_uid, 16); memcpy (&identification->modification_date, &mux->preface->last_modified_date, sizeof (MXFTimestamp)); memcpy (&identification->toolkit_version, &identification->product_version, sizeof (MXFProductVersion)); #ifdef HAVE_SYS_UTSNAME_H { struct utsname sys_details; if (uname (&sys_details) == 0) { identification->platform = g_strdup_printf ("%s %s %s", sys_details.sysname, sys_details.release, sys_details.machine); } } #endif #if defined(G_OS_WIN32) if (identification->platform == NULL) identification->platform = g_strdup ("Microsoft Windows"); #elif defined(G_OS_BEOS) if (identification->platform == NULL) identification->platform = g_strdup ("BEOS"); #elif defined(G_OS_UNIX) if (identification->platform == NULL) identification->platform = g_strdup ("Unix"); #endif } /* Content storage */ { MXFMetadataContentStorage *cstorage; guint i; cstorage = mux->preface->content_storage = (MXFMetadataContentStorage *) gst_mini_object_new (MXF_TYPE_METADATA_CONTENT_STORAGE); mxf_uuid_init (&MXF_METADATA_BASE (cstorage)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (cstorage)->instance_uid, cstorage); mux->metadata_list = g_list_prepend (mux->metadata_list, cstorage); cstorage->n_packages = 2; cstorage->packages = g_new0 (MXFMetadataGenericPackage *, 2); /* Source package */ { MXFMetadataSourcePackage *p; cstorage->packages[1] = (MXFMetadataGenericPackage *) gst_mini_object_new (MXF_TYPE_METADATA_SOURCE_PACKAGE); mxf_uuid_init (&MXF_METADATA_BASE (cstorage->packages[1])->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (cstorage->packages[1])->instance_uid, cstorage->packages[1]); mux->metadata_list = g_list_prepend (mux->metadata_list, cstorage->packages[1]); p = (MXFMetadataSourcePackage *) cstorage->packages[1]; mxf_umid_init (&p->parent.package_uid); p->parent.name = g_strdup ("Source package"); memcpy (&p->parent.package_creation_date, &mux->preface->last_modified_date, sizeof (MXFTimestamp)); memcpy (&p->parent.package_modified_date, &mux->preface->last_modified_date, sizeof (MXFTimestamp)); p->parent.n_tracks = g_slist_length (mux->collect->data); p->parent.tracks = g_new0 (MXFMetadataTrack *, p->parent.n_tracks); if (p->parent.n_tracks > 1) { MXFMetadataMultipleDescriptor *d; p->descriptor = (MXFMetadataGenericDescriptor *) gst_mini_object_new (MXF_TYPE_METADATA_MULTIPLE_DESCRIPTOR); d = (MXFMetadataMultipleDescriptor *) p->descriptor; d->n_sub_descriptors = p->parent.n_tracks; d->sub_descriptors = g_new0 (MXFMetadataGenericDescriptor *, p->parent.n_tracks); mxf_uuid_init (&MXF_METADATA_BASE (d)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (d)->instance_uid, d); mux->metadata_list = g_list_prepend (mux->metadata_list, d); } /* Tracks */ { guint n = 0; /* Essence tracks */ for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; MXFMetadataTimelineTrack *track; MXFMetadataSequence *sequence; MXFMetadataSourceClip *clip; p->parent.tracks[n] = (MXFMetadataTrack *) gst_mini_object_new (MXF_TYPE_METADATA_TIMELINE_TRACK); track = (MXFMetadataTimelineTrack *) p->parent.tracks[n]; mxf_uuid_init (&MXF_METADATA_BASE (track)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (track)->instance_uid, track); mux->metadata_list = g_list_prepend (mux->metadata_list, track); track->parent.track_id = n + 1; track->parent.track_number = cpad->writer->get_track_number_template (cpad->descriptor, GST_PAD_CAPS (cpad->collect.pad), cpad->mapping_data); cpad->writer->get_edit_rate (cpad->descriptor, GST_PAD_CAPS (cpad->collect.pad), cpad->mapping_data, cpad->collect.buffer, p, track, &track->edit_rate); sequence = track->parent.sequence = (MXFMetadataSequence *) gst_mini_object_new (MXF_TYPE_METADATA_SEQUENCE); mxf_uuid_init (&MXF_METADATA_BASE (sequence)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (sequence)->instance_uid, sequence); mux->metadata_list = g_list_prepend (mux->metadata_list, sequence); memcpy (&sequence->data_definition, &cpad->writer->data_definition, 16); sequence->n_structural_components = 1; sequence->structural_components = g_new0 (MXFMetadataStructuralComponent *, 1); clip = (MXFMetadataSourceClip *) gst_mini_object_new (MXF_TYPE_METADATA_SOURCE_CLIP); sequence->structural_components[0] = (MXFMetadataStructuralComponent *) clip; mxf_uuid_init (&MXF_METADATA_BASE (clip)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (clip)->instance_uid, clip); mux->metadata_list = g_list_prepend (mux->metadata_list, clip); memcpy (&clip->parent.data_definition, &sequence->data_definition, 16); clip->start_position = 0; cpad->source_package = p; cpad->source_track = track; cpad->descriptor->linked_track_id = n + 1; if (p->parent.n_tracks == 1) { p->descriptor = (MXFMetadataGenericDescriptor *) cpad->descriptor; } else { MXF_METADATA_MULTIPLE_DESCRIPTOR (p->descriptor)-> sub_descriptors[n] = (MXFMetadataGenericDescriptor *) cpad->descriptor; } n++; } } } /* Material package */ { MXFMetadataMaterialPackage *p; MXFFraction min_edit_rate = { 0, 0 }; gdouble min_edit_rate_d = G_MAXDOUBLE; cstorage->packages[0] = (MXFMetadataGenericPackage *) gst_mini_object_new (MXF_TYPE_METADATA_MATERIAL_PACKAGE); memcpy (&MXF_METADATA_BASE (cstorage->packages[0])->instance_uid, &mux->preface->primary_package_uid, 16); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (cstorage->packages[0])->instance_uid, cstorage->packages[0]); mux->metadata_list = g_list_prepend (mux->metadata_list, cstorage->packages[0]); p = (MXFMetadataMaterialPackage *) cstorage->packages[0]; mxf_umid_init (&p->package_uid); p->name = g_strdup ("Material package"); memcpy (&p->package_creation_date, &mux->preface->last_modified_date, sizeof (MXFTimestamp)); memcpy (&p->package_modified_date, &mux->preface->last_modified_date, sizeof (MXFTimestamp)); p->n_tracks = g_slist_length (mux->collect->data) + 1; p->tracks = g_new0 (MXFMetadataTrack *, p->n_tracks); /* Tracks */ { guint n; n = 1; /* Essence tracks */ for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; MXFMetadataSourcePackage *source_package; MXFMetadataTimelineTrack *track, *source_track; MXFMetadataSequence *sequence; MXFMetadataSourceClip *clip; source_package = MXF_METADATA_SOURCE_PACKAGE (cstorage->packages[1]); source_track = MXF_METADATA_TIMELINE_TRACK (source_package->parent.tracks[n - 1]); p->tracks[n] = (MXFMetadataTrack *) gst_mini_object_new (MXF_TYPE_METADATA_TIMELINE_TRACK); track = (MXFMetadataTimelineTrack *) p->tracks[n]; mxf_uuid_init (&MXF_METADATA_BASE (track)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (track)->instance_uid, track); mux->metadata_list = g_list_prepend (mux->metadata_list, track); track->parent.track_id = n + 1; track->parent.track_number = 0; cpad->writer->get_edit_rate (cpad->descriptor, GST_PAD_CAPS (cpad->collect.pad), cpad->mapping_data, cpad->collect.buffer, source_package, source_track, &track->edit_rate); if (track->edit_rate.n != source_track->edit_rate.n || track->edit_rate.d != source_track->edit_rate.d) { memcpy (&source_track->edit_rate, &track->edit_rate, sizeof (MXFFraction)); } if (track->edit_rate.d <= 0 || track->edit_rate.n <= 0) { GST_ERROR_OBJECT (mux, "Invalid edit rate"); return GST_FLOW_ERROR; } if (min_edit_rate_d > ((gdouble) track->edit_rate.n) / ((gdouble) track->edit_rate.d)) { min_edit_rate_d = ((gdouble) track->edit_rate.n) / ((gdouble) track->edit_rate.d); memcpy (&min_edit_rate, &track->edit_rate, sizeof (MXFFraction)); } sequence = track->parent.sequence = (MXFMetadataSequence *) gst_mini_object_new (MXF_TYPE_METADATA_SEQUENCE); mxf_uuid_init (&MXF_METADATA_BASE (sequence)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (sequence)->instance_uid, sequence); mux->metadata_list = g_list_prepend (mux->metadata_list, sequence); memcpy (&sequence->data_definition, &cpad->writer->data_definition, 16); sequence->n_structural_components = 1; sequence->structural_components = g_new0 (MXFMetadataStructuralComponent *, 1); clip = (MXFMetadataSourceClip *) gst_mini_object_new (MXF_TYPE_METADATA_SOURCE_CLIP); sequence->structural_components[0] = (MXFMetadataStructuralComponent *) clip; mxf_uuid_init (&MXF_METADATA_BASE (clip)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (clip)->instance_uid, clip); mux->metadata_list = g_list_prepend (mux->metadata_list, clip); memcpy (&clip->parent.data_definition, &sequence->data_definition, 16); clip->start_position = 0; memcpy (&clip->source_package_id, &cstorage->packages[1]->package_uid, 32); clip->source_track_id = n; n++; } n = 0; /* Timecode track */ { MXFMetadataTimelineTrack *track; MXFMetadataSequence *sequence; MXFMetadataTimecodeComponent *component; p->tracks[n] = (MXFMetadataTrack *) gst_mini_object_new (MXF_TYPE_METADATA_TIMELINE_TRACK); track = (MXFMetadataTimelineTrack *) p->tracks[n]; mxf_uuid_init (&MXF_METADATA_BASE (track)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (track)->instance_uid, track); mux->metadata_list = g_list_prepend (mux->metadata_list, track); track->parent.track_id = n + 1; track->parent.track_number = 0; track->parent.track_name = g_strdup ("Timecode track"); /* FIXME: Is this correct? */ memcpy (&track->edit_rate, &min_edit_rate, sizeof (MXFFraction)); sequence = track->parent.sequence = (MXFMetadataSequence *) gst_mini_object_new (MXF_TYPE_METADATA_SEQUENCE); mxf_uuid_init (&MXF_METADATA_BASE (sequence)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (sequence)->instance_uid, sequence); mux->metadata_list = g_list_prepend (mux->metadata_list, sequence); memcpy (&sequence->data_definition, mxf_metadata_track_identifier_get (MXF_METADATA_TRACK_TIMECODE_12M_INACTIVE), 16); sequence->n_structural_components = 1; sequence->structural_components = g_new0 (MXFMetadataStructuralComponent *, 1); component = (MXFMetadataTimecodeComponent *) gst_mini_object_new (MXF_TYPE_METADATA_TIMECODE_COMPONENT); sequence->structural_components[0] = (MXFMetadataStructuralComponent *) component; mxf_uuid_init (&MXF_METADATA_BASE (component)->instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (component)->instance_uid, component); mux->metadata_list = g_list_prepend (mux->metadata_list, component); memcpy (&component->parent.data_definition, &sequence->data_definition, 16); component->start_timecode = 0; component->rounded_timecode_base = (((gdouble) track->edit_rate.n) / ((gdouble) track->edit_rate.d) + 0.5); /* TODO: drop frame */ } memcpy (&mux->min_edit_rate, &min_edit_rate, sizeof (MXFFraction)); } } for (i = 0; i < cstorage->packages[1]->n_tracks; i++) { MXFMetadataTrack *track = cstorage->packages[1]->tracks[i]; guint j; guint32 templ; guint8 n_type, n; if ((track->track_number & 0x00ff00ff) != 0) continue; templ = track->track_number; n_type = 0; for (j = 0; j < cstorage->packages[1]->n_tracks; j++) { MXFMetadataTrack *tmp = cstorage->packages[1]->tracks[j]; if (tmp->track_number == templ) { n_type++; } } n = 0; for (j = 0; j < cstorage->packages[1]->n_tracks; j++) { MXFMetadataTrack *tmp = cstorage->packages[1]->tracks[j]; if (tmp->track_number == templ) { n++; tmp->track_number |= (n_type << 16) | (n); } } } cstorage->n_essence_container_data = 1; cstorage->essence_container_data = g_new0 (MXFMetadataEssenceContainerData *, 1); cstorage->essence_container_data[0] = (MXFMetadataEssenceContainerData *) gst_mini_object_new (MXF_TYPE_METADATA_ESSENCE_CONTAINER_DATA); mxf_uuid_init (&MXF_METADATA_BASE (cstorage->essence_container_data[0])-> instance_uid, mux->metadata); g_hash_table_insert (mux->metadata, &MXF_METADATA_BASE (cstorage->essence_container_data[0])->instance_uid, cstorage->essence_container_data[0]); mux->metadata_list = g_list_prepend (mux->metadata_list, cstorage->essence_container_data[0]); cstorage->essence_container_data[0]->linked_package = MXF_METADATA_SOURCE_PACKAGE (cstorage->packages[1]); cstorage->essence_container_data[0]->index_sid = 0; cstorage->essence_container_data[0]->body_sid = 1; }
void gstreamer_get_version(guint *major, guint *minor, guint *micro) { guint nano; gst_version(major, minor, micro, &nano); }
int main(int argc, char *argv[]) { GMainLoop* main_loop; GSocketService* socket; GError* error = NULL; GstBus *bus; guint bus_watch_id; config_t * conf; video_server_t* server; guint major = glib_major_version; guint minor = glib_minor_version; guint micro = glib_micro_version; guint nano = 0; fprintf(stderr, "Glib version %d.%d.%d\n", major, minor, micro); /* initialise gsatreamer */ gst_init(&argc, &argv); gst_version(&major, &minor, µ, &nano); fprintf(stderr, "GStreamer version %d.%d.%d (%d)\n", major, minor, micro, nano); conf = config_create(argc, argv); server = video_server_create(conf); main_loop = g_main_loop_new (NULL, FALSE); g_unix_signal_add(SIGHUP, signal_handler, main_loop); g_unix_signal_add(SIGTERM, signal_handler, main_loop); g_unix_signal_add(SIGINT, signal_handler, main_loop); /* Message handler */ bus = gst_pipeline_get_bus(GST_PIPELINE(server->pipeline)); bus_watch_id = gst_bus_add_watch(bus, bus_cb, main_loop); gst_object_unref(bus); /* command socket */ socket = g_socket_service_new(); g_socket_listener_add_inet_port((GSocketListener *) socket, conf->cmd_port, NULL, &error); if (error != NULL) fprintf(stderr, "%s\n", error->message); g_signal_connect(socket, "incoming", G_CALLBACK(socket_callback), server); g_socket_service_start(socket); /* Set the pipeline to "playing" state */ fprintf(stderr, "Video server playing\n"); gst_element_set_state(server->pipeline, GST_STATE_PLAYING); /* Iterate */ fprintf(stderr, "Running...\n"); g_main_loop_run(main_loop); /* Stop */ fprintf(stderr, "Stopping video server\n"); gst_element_set_state(server->pipeline, GST_STATE_NULL); fprintf(stderr, "Deleting pipeline\n"); video_server_delete(server); g_source_remove(bus_watch_id); g_main_loop_unref(main_loop); return 0; }
gboolean set_properties_for_channel (GObject * dvbbasebin, const gchar * channel_name) { gboolean ret = FALSE; GHashTable *channels; gchar *filename; filename = g_strdup (g_getenv ("GST_DVB_CHANNELS_CONF")); if (filename == NULL) { guint major, minor, micro, nano; gst_version (&major, &minor, µ, &nano); filename = g_strdup_printf ("%s/.gstreamer-%d.%d/dvb-channels.conf", g_get_home_dir (), major, minor); } channels = parse_channels_conf_from_file (filename); g_free (filename); if (channels) { GHashTable *params = g_hash_table_lookup (channels, channel_name); if (params) { gchar *type; const gchar *adapter; g_object_set (dvbbasebin, "program-numbers", g_hash_table_lookup (params, "sid"), NULL); /* check if it is terrestrial or satellite */ adapter = g_getenv ("GST_DVB_ADAPTER"); if (adapter) g_object_set (dvbbasebin, "adapter", atoi (adapter), NULL); g_object_set (dvbbasebin, "frequency", atoi (g_hash_table_lookup (params, "frequency")), NULL); type = g_hash_table_lookup (params, "type"); if (strcmp (type, "terrestrial") == 0) { gchar *val; val = g_hash_table_lookup (params, "inversion"); if (strcmp (val, "INVERSION_OFF") == 0) g_object_set (dvbbasebin, "inversion", 0, NULL); else if (strcmp (val, "INVERSION_ON") == 0) g_object_set (dvbbasebin, "inversion", 1, NULL); else g_object_set (dvbbasebin, "inversion", 2, NULL); val = g_hash_table_lookup (params, "bandwidth"); if (strcmp (val, "BANDWIDTH_8_MHZ") == 0) g_object_set (dvbbasebin, "bandwidth", 0, NULL); else if (strcmp (val, "BANDWIDTH_7_MHZ") == 0) g_object_set (dvbbasebin, "bandwidth", 1, NULL); else if (strcmp (val, "BANDWIDTH_6_MHZ") == 0) g_object_set (dvbbasebin, "bandwidth", 2, NULL); else g_object_set (dvbbasebin, "bandwidth", 3, NULL); val = g_hash_table_lookup (params, "code-rate-hp"); if (strcmp (val, "FEC_NONE") == 0) g_object_set (dvbbasebin, "code-rate-hp", 0, NULL); else if (strcmp (val, "FEC_1_2") == 0) g_object_set (dvbbasebin, "code-rate-hp", 1, NULL); else if (strcmp (val, "FEC_2_3") == 0) g_object_set (dvbbasebin, "code-rate-hp", 2, NULL); else if (strcmp (val, "FEC_3_4") == 0) g_object_set (dvbbasebin, "code-rate-hp", 3, NULL); else if (strcmp (val, "FEC_4_5") == 0) g_object_set (dvbbasebin, "code-rate-hp", 4, NULL); else if (strcmp (val, "FEC_5_6") == 0) g_object_set (dvbbasebin, "code-rate-hp", 5, NULL); else if (strcmp (val, "FEC_6_7") == 0) g_object_set (dvbbasebin, "code-rate-hp", 6, NULL); else if (strcmp (val, "FEC_7_8") == 0) g_object_set (dvbbasebin, "code-rate-hp", 7, NULL); else if (strcmp (val, "FEC_8_9") == 0) g_object_set (dvbbasebin, "code-rate-hp", 8, NULL); else g_object_set (dvbbasebin, "code-rate-hp", 9, NULL); val = g_hash_table_lookup (params, "code-rate-lp"); if (strcmp (val, "FEC_NONE") == 0) g_object_set (dvbbasebin, "code-rate-lp", 0, NULL); else if (strcmp (val, "FEC_1_2") == 0) g_object_set (dvbbasebin, "code-rate-lp", 1, NULL); else if (strcmp (val, "FEC_2_3") == 0) g_object_set (dvbbasebin, "code-rate-lp", 2, NULL); else if (strcmp (val, "FEC_3_4") == 0) g_object_set (dvbbasebin, "code-rate-lp", 3, NULL); else if (strcmp (val, "FEC_4_5") == 0) g_object_set (dvbbasebin, "code-rate-lp", 4, NULL); else if (strcmp (val, "FEC_5_6") == 0) g_object_set (dvbbasebin, "code-rate-lp", 5, NULL); else if (strcmp (val, "FEC_6_7") == 0) g_object_set (dvbbasebin, "code-rate-lp", 6, NULL); else if (strcmp (val, "FEC_7_8") == 0) g_object_set (dvbbasebin, "code-rate-lp", 7, NULL); else if (strcmp (val, "FEC_8_9") == 0) g_object_set (dvbbasebin, "code-rate-lp", 8, NULL); else g_object_set (dvbbasebin, "code-rate-lp", 9, NULL); val = g_hash_table_lookup (params, "modulation"); if (strcmp (val, "QPSK") == 0) g_object_set (dvbbasebin, "modulation", 0, NULL); else if (strcmp (val, "QAM_16") == 0) g_object_set (dvbbasebin, "modulation", 1, NULL); else if (strcmp (val, "QAM_32") == 0) g_object_set (dvbbasebin, "modulation", 2, NULL); else if (strcmp (val, "QAM_64") == 0) g_object_set (dvbbasebin, "modulation", 3, NULL); else if (strcmp (val, "QAM_128") == 0) g_object_set (dvbbasebin, "modulation", 4, NULL); else if (strcmp (val, "QAM_256") == 0) g_object_set (dvbbasebin, "modulation", 5, NULL); else g_object_set (dvbbasebin, "modulation", 6, NULL); val = g_hash_table_lookup (params, "transmission-mode"); if (strcmp (val, "TRANSMISSION_MODE_2K") == 0) g_object_set (dvbbasebin, "trans-mode", 0, NULL); else if (strcmp (val, "TRANSMISSION_MODE_8K") == 0) g_object_set (dvbbasebin, "trans-mode", 1, NULL); else g_object_set (dvbbasebin, "trans-mode", 2, NULL); val = g_hash_table_lookup (params, "guard"); if (strcmp (val, "GUARD_INTERVAL_1_32") == 0) g_object_set (dvbbasebin, "guard", 0, NULL); else if (strcmp (val, "GUARD_INTERVAL_1_16") == 0) g_object_set (dvbbasebin, "guard", 1, NULL); else if (strcmp (val, "GUARD_INTERVAL_1_8") == 0) g_object_set (dvbbasebin, "guard", 2, NULL); else if (strcmp (val, "GUARD_INTERVAL_1_4") == 0) g_object_set (dvbbasebin, "guard", 3, NULL); else g_object_set (dvbbasebin, "guard", 4, NULL); val = g_hash_table_lookup (params, "hierarchy"); if (strcmp (val, "HIERARCHY_NONE") == 0) g_object_set (dvbbasebin, "hierarchy", 0, NULL); else if (strcmp (val, "HIERARCHY_1") == 0) g_object_set (dvbbasebin, "hierarchy", 1, NULL); else if (strcmp (val, "HIERARCHY_2") == 0) g_object_set (dvbbasebin, "hierarchy", 2, NULL); else if (strcmp (val, "HIERARCHY_4") == 0) g_object_set (dvbbasebin, "hierarchy", 3, NULL); else g_object_set (dvbbasebin, "hierarchy", 4, NULL); ret = TRUE; } else if (strcmp (type, "satellite") == 0) { gchar *val; ret = TRUE; val = g_hash_table_lookup (params, "polarity"); if (val) g_object_set (dvbbasebin, "polarity", val, NULL); else ret = FALSE; val = g_hash_table_lookup (params, "diseqc-source"); if (val) g_object_set (dvbbasebin, "diseqc-source", atoi (val), NULL); val = g_hash_table_lookup (params, "symbol-rate"); if (val) g_object_set (dvbbasebin, "symbol-rate", atoi (val), NULL); else ret = FALSE; } else if (strcmp (type, "cable") == 0) { gchar *val; ret = TRUE; val = g_hash_table_lookup (params, "symbol-rate"); if (val) g_object_set (dvbbasebin, "symbol-rate", atoi (val) / 1000, NULL); val = g_hash_table_lookup (params, "modulation"); if (strcmp (val, "QPSK") == 0) g_object_set (dvbbasebin, "modulation", 0, NULL); else if (strcmp (val, "QAM_16") == 0) g_object_set (dvbbasebin, "modulation", 1, NULL); else if (strcmp (val, "QAM_32") == 0) g_object_set (dvbbasebin, "modulation", 2, NULL); else if (strcmp (val, "QAM_64") == 0) g_object_set (dvbbasebin, "modulation", 3, NULL); else if (strcmp (val, "QAM_128") == 0) g_object_set (dvbbasebin, "modulation", 4, NULL); else if (strcmp (val, "QAM_256") == 0) g_object_set (dvbbasebin, "modulation", 5, NULL); else g_object_set (dvbbasebin, "modulation", 6, NULL); val = g_hash_table_lookup (params, "code-rate-hp"); if (strcmp (val, "FEC_NONE") == 0) g_object_set (dvbbasebin, "code-rate-hp", 0, NULL); else if (strcmp (val, "FEC_1_2") == 0) g_object_set (dvbbasebin, "code-rate-hp", 1, NULL); else if (strcmp (val, "FEC_2_3") == 0) g_object_set (dvbbasebin, "code-rate-hp", 2, NULL); else if (strcmp (val, "FEC_3_4") == 0) g_object_set (dvbbasebin, "code-rate-hp", 3, NULL); else if (strcmp (val, "FEC_4_5") == 0) g_object_set (dvbbasebin, "code-rate-hp", 4, NULL); else if (strcmp (val, "FEC_5_6") == 0) g_object_set (dvbbasebin, "code-rate-hp", 5, NULL); else if (strcmp (val, "FEC_6_7") == 0) g_object_set (dvbbasebin, "code-rate-hp", 6, NULL); else if (strcmp (val, "FEC_7_8") == 0) g_object_set (dvbbasebin, "code-rate-hp", 7, NULL); else if (strcmp (val, "FEC_8_9") == 0) g_object_set (dvbbasebin, "code-rate-hp", 8, NULL); else g_object_set (dvbbasebin, "code-rate-hp", 9, NULL); val = g_hash_table_lookup (params, "inversion"); if (strcmp (val, "INVERSION_OFF") == 0) g_object_set (dvbbasebin, "inversion", 0, NULL); else if (strcmp (val, "INVERSION_ON") == 0) g_object_set (dvbbasebin, "inversion", 1, NULL); else g_object_set (dvbbasebin, "inversion", 2, NULL); } } destroy_channels_hash (channels); } return ret; }
/* entry point */ int main (int argc, char **argv) { GtkWidget *mainwin; gint n_burners; GError *error = NULL; #ifdef HAVE_GUDEV gchar *error_msg; #endif XfburnTranscoder *transcoder; XfburnDeviceList *devlist; #if DEBUG > 0 /* I have to disable this until GtkTreeView gets fixed, * and doesn't complain anymore when a DnD doesn't add any * rows g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); */ #endif g_set_application_name (_("Xfburn")); gdk_threads_init (); gdk_threads_enter (); xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); if (!gtk_init_with_args (&argc, &argv, "", optionentries, GETTEXT_PACKAGE, &error)) { if (error != NULL) { g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, error->message, PACKAGE_NAME); g_error_free (error); return EXIT_FAILURE; } } if (!burn_initialize ()) { g_critical ("Unable to initialize libburn"); xfce_dialog_show_error (NULL, NULL, _("Unable to initialize the burning backend.")); gdk_threads_leave (); return EXIT_FAILURE; } #ifdef HAVE_GST if (!gst_init_check (&argc, &argv, &error)) { g_critical ("Failed to initialize gstreamer!"); /* I'm assuming this pretty much never happens. If it does, we should make this a soft failure and fall back to basic */ gdk_threads_leave (); burn_finish (); return EXIT_FAILURE; } #endif if (show_version) { #ifdef HAVE_GST const char *nano_str; guint gst_major, gst_minor, gst_micro, gst_nano; #endif g_print ("%s version %s for Xfce %s\n", PACKAGE, VERSION, xfce_version_string ()); g_print ("\tbuilt with GTK+-%d.%d.%d, ", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); g_print ("linked with GTK+-%d.%d.%d.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); #ifdef HAVE_GST gst_version (&gst_major, &gst_minor, &gst_micro, &gst_nano); if (gst_nano == 1) nano_str = " (CVS)"; else if (gst_nano == 2) nano_str = " (Prerelease)"; else nano_str = ""; g_print ("\tGStreamer support (built with %d.%d.%d, linked against %d.%d.%d%s)\n", GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO, gst_major, gst_minor, gst_micro, nano_str); #endif exit (EXIT_SUCCESS); } if (transcoder_selection && strcmp (transcoder_selection, "list") == 0) { print_available_transcoders(); gdk_threads_leave (); burn_finish (); return EXIT_SUCCESS; } DBG ("%s version %s for Xfce %s\n", PACKAGE, VERSION, xfce_version_string ()); xfburn_settings_init (); #ifdef HAVE_GUDEV error_msg = xfburn_udev_manager_create_global (); if (error_msg) { xfce_dialog_show_error (NULL, NULL, "%s", error_msg); gdk_threads_leave (); burn_finish (); return EXIT_FAILURE; } else { g_message ("Using UDEV"); } #endif xfburn_stock_init (); devlist = xfburn_device_list_new (); g_object_get (devlist, "num-burners", &n_burners, NULL); if (n_burners < 1) { GtkMessageDialog *dialog = (GtkMessageDialog *) gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, ((const gchar *) _("No burners are currently available"))); gtk_message_dialog_format_secondary_text (dialog, _("Possibly the disc(s) are in use, and cannot get accessed.\n\n" "Please unmount and restart the application.\n\n" "If no disc is in the drive, check that you have read and write access to the drive with the current user.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog)); } /*----------Transcoder--------------------------------------------------*/ if (!transcoder_selection) { /* select the best available */ #ifdef HAVE_GST transcoder = XFBURN_TRANSCODER (xfburn_transcoder_gst_new ()); #else transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ()); #endif #ifdef HAVE_GST } else if (strcmp (transcoder_selection, "gst") == 0) { transcoder = XFBURN_TRANSCODER (xfburn_transcoder_gst_new ()); #endif } else if (strcmp (transcoder_selection, "basic") == 0) { transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ()); } else { g_print ("'%s' is an invalid transcoder selection.\n", transcoder_selection); g_print ("\n"); print_available_transcoders(); gdk_threads_leave (); burn_finish (); return EXIT_FAILURE; } if (!xfburn_transcoder_is_initialized (transcoder, &error)) { xfce_dialog_show_warning(NULL, NULL, _("Failed to initialize %s transcoder: %s\n\t(falling back to basic implementation)"), xfburn_transcoder_get_name (transcoder), error->message); g_error_free (error); g_object_unref (transcoder); transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ()); } else { g_message ("Using %s transcoder.", xfburn_transcoder_get_name (transcoder)); } xfburn_transcoder_set_global (transcoder); /*----------evaluate parsed command line action options-------------------------*/ /* heuristic for file names on the commandline */ if (argc == 2 && !add_data_composition && !add_audio_composition) { /* exactly one filename, assume it is an image */ image_filename = argv[1]; } else if (argc > 2) { /* several file names, for now just open up a data composition */ /* TODO: auto-detect music files for audio compositions */ add_data_composition = TRUE; } if (show_main) { xfburn_main_enter_main_window (); } if (image_filename != NULL) { GtkWidget *dialog = xfburn_burn_image_dialog_new (); other_action = TRUE; DBG ("image_filename = '%s'\n", image_filename); if (*image_filename != '\0') { gchar *image_fullname; if (!g_path_is_absolute (image_filename)) image_fullname = g_build_filename (g_get_current_dir (), image_filename, NULL); else image_fullname = image_filename; if (g_file_test (image_fullname, G_FILE_TEST_EXISTS)) xfburn_burn_image_dialog_set_filechooser_name (dialog, image_fullname); else xfce_dialog_show_error (NULL, NULL, _("Image file '%s' does not exist."), image_fullname); } gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } else if (blank) { GtkWidget *dialog = xfburn_blank_dialog_new (); other_action = TRUE; gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } /*----------main window--------------------------------------------------*/ if (!other_action || show_main) { xfburn_main_enter_main_window (); mainwin = xfburn_main_window_new (); gtk_widget_show (mainwin); if (add_data_composition) xfburn_main_window_add_data_composition_with_files (XFBURN_MAIN_WINDOW (mainwin), argc-1, argv+1); if (add_audio_composition) xfburn_main_window_add_audio_composition_with_files (XFBURN_MAIN_WINDOW (mainwin), argc-1, argv+1); } gtk_main (); /*----------shutdown--------------------------------------------------*/ g_object_unref (devlist); g_object_unref (transcoder); #ifdef HAVE_GUDEV xfburn_udev_manager_shutdown (); #endif xfburn_settings_flush (); xfburn_settings_free (); burn_finish (); gdk_threads_leave (); return EXIT_SUCCESS; }
/* ============================================================================ * @Function: rtspmodule_init * @Description: Initialize GST Application interface. * ============================================================================ */ int rtspmodule_init (struct rtspmodule_arguments *arg) { guint major, minor, micro, nano; GstBus *bus; /* Settings - Encoder and Streaming */ arguments.width = arg->width; arguments.height = arg->height; arguments.gfps = arg->gfps; arguments.gbitrate = arg->gbitrate; arguments.gmtu = arg->gmtu; arguments.vsrc = arg->vsrc; arguments.vencoder = g_strdup(arg->vencoder); arguments.rtpencoder = arg->rtpencoder; /* GSTAPP Setup */ gst_init(NULL, NULL); gst_version(&major, &minor, µ, &nano); g_print("..This program is linked against GStreamer %d.%d.%d\n", major, minor, micro); loop = g_main_loop_new(NULL, FALSE); datasize = arguments.height * arguments.width * 4; databuffer = gst_buffer_new_and_alloc (datasize); inputdatabuffer = malloc ((sizeof(char))*datasize); pipeline = construct_app_pipeline(); if ( !pipeline ) { g_printerr("Failed to construct pipeline\n"); return -1; } g_print("..GSTAPP Pipeline Setup... \n"); /* we add a message handler */ bus = gst_pipeline_get_bus(GST_PIPELINE (pipeline)); gst_bus_add_watch(bus, bus_watch, loop); gst_object_unref(bus); /* create a server instance */ server = gst_rtsp_server_new (); /* get the mapping for this server, every server has a default mapper object * that be used to map uri mount points to media factories */ mapping = gst_rtsp_server_get_media_mapping (server); /* make a media factory for a test stream. * The default media factory can use * gst-launch syntax to create pipelines. * any launch line works as long as it contains elements * named pay%d. Each element with pay%d names will be a stream */ //factory = gst_rtsp_media_factory_new (); factory = GST_RTSP_MEDIA_FACTORY(gst_rtsp_media_factory_custom_new()); // allow multiple clients to see the same video gst_rtsp_media_factory_set_shared (factory, TRUE); g_object_set(factory, "bin", pipeline, NULL); /* attach the test factory to the /test url */ gst_rtsp_media_mapping_add_factory (mapping, "/bbwatch", factory); /* don't need the ref to the mapping anymore */ g_object_unref (mapping); /* attach the server to the default maincontext */ gst_rtsp_server_attach (server, NULL); /* add a timeout for the session cleanup */ g_timeout_add_seconds (2, (GSourceFunc) cleanup_timeout, server); g_print("..GST Pipeline Initialized ...\n"); return 0; }
static gboolean parse_options (int argc, char *argv[], App * app) { int opt; const gchar *optionsString = "vecq:s:r:?"; struct option optionsTable[] = { {"entrypoints", optional_argument, NULL, 'e'}, {"cutlist", optional_argument, NULL, 'c'}, {"queue-size", required_argument, NULL, 'q'}, {"source-pids", required_argument, NULL, 's'}, {"result-pids", required_argument, NULL, 'r'}, {"help", no_argument, NULL, '?'}, {"version", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0} }; if (argc == 1) goto usage; if (argc > 2) app->in_filename = g_strdup (argv[1]); app->out_filename = g_strdup (argv[2]); while ((opt = getopt_long (argc, argv, optionsString, optionsTable, NULL)) >= 0) { switch (opt) { case 'e': app->enable_indexing = TRUE; if (optarg != NULL) { app->epmap_filename = g_strdup(optarg); GST_DEBUG ("arbitrary epmap_filename=%s", app->epmap_filename); } else { GST_DEBUG ("display ep map on stdout"); } break; case 'c': app->enable_cutlist = TRUE; if (optarg != NULL) { app->cuts_filename = g_strdup(optarg); GST_DEBUG ("arbitrary cuts_filename=%s", app->cuts_filename); } else { app->cuts_filename = g_strconcat (app->in_filename, ".cuts", NULL); GST_DEBUG ("enigma2-style cuts_filename=%s", app->cuts_filename); } break; case 'q': app->queue_size = atoi(optarg); GST_DEBUG("arbitrary queue size=%i", app->queue_size); break; case 's': parse_pid_list (app->a_source_pids, &app->no_source_pids, optarg); app->auto_pids = FALSE; break; case 'r': parse_pid_list (app->a_sink_pids, &app->no_sink_pids, optarg); break; case 'v': { const gchar *nano_str; guint major, minor, micro, nano; gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(GIT)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; g_print ("bdremux 0.1 is linked against GStreamer %d.%d.%d %s\n", major, minor, micro, nano_str); exit (0); } case '?': goto usage; break; default: break; } } return TRUE; usage: g_print ("bdremux - a blu-ray movie stream remuxer <*****@*****.**>\n" "\n" "Usage: %s source_stream.ts output_stream.m2ts [OPTION...]\n" "\n" "Optional arguments:\n" " -e, --entrypoints Generate and display the SPN/PTS map\n" " -c, --cutlist use enigma2's $source_stream.ts.cuts file\n" " -q, --queue-size=INT max size of queue in bytes (default=%i)\n" " -s, --source-pids=STRING list of PIDs to be considered\n" " -r, --result-pids=STRING list of PIDs in resulting stream\n" " PIDs can be supplied in decimal or hexadecimal form (0x prefixed)\n" " the lists are supposed to be comma-seperated with the Video PID\n" " as the first element followed by 1-7 Audio PIDs.\n" " If omitted, the first video and all audio elementary streams are\n" " carried over, keeping their PIDs (this may require a larger queue size).\n" "\n" "Help options:\n" " -?, --help Show this help message\n" " -v, --version Display GSTREAMER version\n" "\n" "Example: %s in.ts out.m2ts -e -s0x40,0x4A,0x4C -r0x1011,0x1100,0x1101\n" " Will extract the video elementary stream with PID 0x40 and the audio\n" " streams with PIDs 0x41 and 0x4C from the file in.ts and write new\n" " remultiplexed streams with PID numbers 0x1011 for video and 0x1100\n" " and 0x1101 for audio into the file out.m2ts while showing a map\n" " of entrypoints on stdout.\n", argv[0], DEFAULT_QUEUE_SIZE, argv[0]); exit (0); return TRUE; }