libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moDecoderManager.cpp
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moDecoderManager.cpp
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 *******************************************************************************/
30 
31 #include "moDecoderManager.h"
32 
33 
34 
35 //===========================================
36 //
37 // moVdpauManager
38 //
39 //===========================================
40 
42 {
45  SetName("decodermanager");
46  SetLabelName("decodermanager");
47 
48  m_pDecoderDevice = NULL;
49  m_pVideoDecoder = NULL;
50  m_pVideoMixer = NULL;
51 
52  m_pVideoGraph = NULL;
53 
54  #ifdef MO_VDPAU
55  m_DecoderType = MO_DECODERTYPE_VDPAU;
56  #endif
57 
58 }
59 
61 {
62  Finish();
63 }
64 
66 {
67  if ( m_pResourceManager ) {
68  //m_glmanager = m_pResourceManager->GetGLMan();
69  #ifdef MO_VDPAU
70 
71  //m_pDecoderDevice = (moDecoderDevice*) new VdpDevice();
72 
73  //typedef VdpStatus VdpDeviceCreateX11(Display *display, int screen,VdpDevice *device, VdpGetProcAddress **get_proc_address)
74  //VdpGetProcAddress *vdp_get_proc_add;
75  Display* vdp_xdisplay;
76  vdp_xdisplay = NULL;
77  VdpStatus vdp_st;
78  int screen;
79  screen = 0;
80  //VdpDevice vdp_device;
81  VdpDecoderProfile vdp_decoder_profile;
82  //VdpGetProcAddress* vdp_get_proc_address;
83  //VdpDecoder vdp_decoder;
84 
85  vdp_device = 0;
86  vdp_get_proc_address = NULL;
87 
88  int width,height;
89 
90  width = 1920;
91  height = 1080;
92  vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
93 
94  vdp_xdisplay = glXGetCurrentDisplay();
95  if (vdp_xdisplay) {
96  MODebug2->Message( moText("Display:") + IntToStr((long)vdp_xdisplay));
97  screen = DefaultScreen(vdp_xdisplay);
98  if (screen>=0) {
99  MODebug2->Message( moText("Screen:") + IntToStr(screen) );
100  MODebug2->Message( moText("Creating VdpDevice"));
101  vdp_st = vdp_device_create_x11( vdp_xdisplay, screen, &vdp_device, &vdp_get_proc_address );
102  if (vdp_st==VDP_STATUS_OK) {
103 
104  vdp_st = vdp_get_proc_address(vdp_device, VDP_FUNC_ID_DECODER_CREATE, (void **)&vdp_decoder_create);
105  vdp_st = vdp_get_proc_address(vdp_device, VDP_FUNC_ID_GET_ERROR_STRING, (void **)&vdp_get_error_string);
106 
107  MODebug2->Message( moText("VdpStatus: OK => ") + IntToStr(vdp_st) );
108  MODebug2->Message( moText("Creating VdpDecoder"));
109  vdp_st = vdp_decoder_create( vdp_device, vdp_decoder_profile, width, height, 2, &vdp_decoder );
110  if (vdp_st==VDP_STATUS_OK) {
111  MODebug2->Message( moText("VdpStatus: OK => ") + IntToStr(vdp_st) );
112  } else {
113  MODebug2->Message( moText("VdpStatus: Error:") + moText(vdp_get_error_string(vdp_st)) );
114  }
115 
116  } else {
117  MODebug2->Message( moText("VdpStatus: Error:") + IntToStr(vdp_st) );
118  }
119  }
120  }
121 
122 
123 
124 
125 
126 
127  //MODebug2->Message( moText("Screen:") + IntToStr(screen) );
128 
129  //vdp_st = vdp_device_create_x11( vdp_xdisplay, screen, &vdp_device, &vdp_get_proc_address );
130  /*
131  m_pVideoDecoder = (moVideoDecoder*) new VdpDecoder( );
132  m_pVideoGraph = (moVideoGraph*) new moVdpauGraph();
133  */
134  //VdpDecoderProfile profile = 0;
135 
137  //profile = VDP_DECODER_PROFILE_H264_MAIN;
138  /*
139  vdp_st = vdp_decoder_create(
140  vdp_device,
141  vdp_decoder_profile,
142  vid_width,
143  vid_height,
144  max_reference_frames,
145  &decoder
146  );
147  */
148  //VdpStatus Status = VdpDecoderCreate( m_pDecoderDevice, profile, );
149 
150  #endif
151  }
152  return (m_pResourceManager!=NULL);
153 }
154 
156  MODebug2->Message("moDecoderManager::OpenVideo > filename: " + filename );
157 #ifdef MO_VDPAU
158  avcodec_init();
159  avcodec_register_all();
160  av_register_all();
161 
162 
163  const char *pfilename="test.avi";
164 
165  // Open video file
166  if(av_open_input_file(&pFormatCtx, pfilename, NULL, 0, NULL)!=0) {
167  //handleerror();
168  MODebug2->Message("Error");
169  }
170 #endif
171  return false;
172 }
173 
174 
176 {
177 
178  return true;
179 }
void SetName(const moText &p_name)
#define MOboolean
Definition: moTypes.h:385
virtual MOboolean Init()
void SetResourceType(moResourceType p_restype)
clase de para manejar textos
Definition: moText.h:75
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
Definition: moTypes.h:532
virtual MOboolean Finish()
virtual ~moDecoderManager()
moText0 moText
Definition: moText.h:291
void SetLabelName(const moText &p_labelname)
static moDebug * MODebug2
Clase de impresión de errores para depuración.
Definition: moAbstract.h:225
LIBMOLDEO_API moText0 IntToStr(int a)
Definition: moText.cpp:1070
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
Definition: moAbstract.cpp:114
void SetType(moMoldeoObjectType p_type)
MOboolean OpenVideo(moText filename)