Video play with libxine

Linux specific forum
User avatar
lazarusoft
User
User
Posts: 24
Joined: Wed Jan 10, 2007 10:17 pm
Location: Brasil

Video play with libxine

Post by lazarusoft »

My doubt is to show the video in a window GTK or SDL
Redirecting the video to a window?
this code that worked OK in

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;usando xine lib
 #XINE_GUI_SEND_EXPOSE_EVENT      =    3
 #XINE_GUI_SEND_VIDEOWIN_VISIBLE=5
 ;Movie()
 #XINE_VISUAL_TYPE_NONE=0
 #XINE_VISUAL_TYPE_X11 = 1
 #XINE_VISUAL_TYPE_FB = 3
 #XINE_VISUAL_TYPE_GTK=4
 #XINE_VISUAL_TYPE_CACA  =8
 #XINE_VISUAL_TYPE_XCB = 11
;video
 #XINE_PARAM_VO_ASPECT_RATIO =$01000001
 ;
 ;/* xine_get_stream_info */
 #XINE_STREAM_INFO_BITRATE     =      0
 #XINE_STREAM_INFO_SEEKABLE    =      1
 #XINE_STREAM_INFO_VIDEO_WIDTH   =    2
 #XINE_STREAM_INFO_VIDEO_HEIGHT  =    3
 #XINE_STREAM_INFO_VIDEO_RATIO    =   4 ;/* *10000 */
 #XINE_STREAM_INFO_VIDEO_CHANNELS  =  5
 #XINE_STREAM_INFO_VIDEO_STREAMS   =  6
 #XINE_STREAM_INFO_VIDEO_BITRATE   =  7
 #XINE_STREAM_INFO_VIDEO_FOURCC    =  8
 #XINE_STREAM_INFO_VIDEO_HANDLED  =   9 ; /* codec available? */
 #XINE_STREAM_INFO_FRAME_DURATION   = 10; /* 1/90000 sec */
 #XINE_STREAM_INFO_AUDIO_CHANNELS   = 11
 #XINE_STREAM_INFO_AUDIO_BITS     =   12
 #XINE_STREAM_INFO_AUDIO_SAMPLERATE = 13
 #XINE_STREAM_INFO_AUDIO_BITRATE   =  14
 #XINE_STREAM_INFO_AUDIO_FOURCC   =   15
 #XINE_STREAM_INFO_AUDIO_HANDLED   =  16; /* codec available? */
 #XINE_STREAM_INFO_HAS_CHAPTERS   =   17
 #XINE_STREAM_INFO_HAS_VIDEO     =    18
 #XINE_STREAM_INFO_HAS_AUDIO   =      19
 #XINE_STREAM_INFO_IGNORE_VIDEO  =    20
 #XINE_STREAM_INFO_IGNORE_AUDIO   =   21
 #XINE_STREAM_INFO_IGNORE_SPU   =     22
 #XINE_STREAM_INFO_VIDEO_HAS_STILL =  23
 #XINE_STREAM_INFO_MAX_AUDIO_CHANNEL= 24
 #XINE_STREAM_INFO_MAX_SPU_CHANNEL =  25
 #XINE_STREAM_INFO_AUDIO_MODE     =   26
 #XINE_STREAM_INFO_SKIPPED_FRAMES   = 27 ;/* For 1000 frames delivered */
 #XINE_STREAM_INFO_DISCARDED_FRAMES = 28; /* For 1000 frames delivered */
 #XINE_STREAM_INFO_VIDEO_AFD     =    29
 #XINE_STREAM_INFO_DVD_TITLE_NUMBER  = 30
 #XINE_STREAM_INFO_DVD_TITLE_COUNT  = 31
 #XINE_STREAM_INFO_DVD_CHAPTER_NUMBER =32
 #XINE_STREAM_INFO_DVD_CHAPTER_COUNT = 33
 #XINE_STREAM_INFO_DVD_ANGLE_NUMBER =  34
 #XINE_STREAM_INFO_DVD_ANGLE_COUNT  =  35
 ;
 #MxineLib=1
 If OpenLibrary(#MxineLib, "/usr/lib/libxine.so")
   If IsLibrary(#MxineLib)
    PrototypeC.l PB_xine_close(eng.l) : Global xine_close.PB_xine_close =GetFunction(#MxineLib,"xine_close")
     PrototypeC.l PB_xine_new() : Global xine_new.PB_xine_new =GetFunction(#MxineLib,"xine_new")
      PrototypeC.l PB_xine_init(eng.l) : Global xine_init.PB_xine_init =GetFunction(#MxineLib,"xine_init")
     PrototypeC.l PB_xine_open(eng.l,file.s) : Global xine_open.PB_xine_open= GetFunction(#MxineLib,"xine_open")
      PrototypeC.l PB_xine_play(strea.l,start_pos.l,start_time.l) : Global xine_play.PB_xine_play = GetFunction(#MxineLib,"xine_play")
      PrototypeC.l PB_xine_stream_new (eng.l, aud.l, vid.l) : Global xine_stream_new.PB_xine_stream_new  = GetFunction(#MxineLib,"xine_stream_new")
      PrototypeC.l PB_xine_open_audio_driver(eng.l,nulo.l,nuloa.l) : Global xine_open_audio_driver.PB_xine_open_audio_driver =GetFunction(#MxineLib,"xine_open_audio_driver")
      PrototypeC.l PB_xine_open_video_driver(eng.l,nulo.l,tipo.l,nuloa.l) : Global xine_open_video_driver.PB_xine_open_video_driver =GetFunction(#MxineLib,"xine_open_video_driver")
      PrototypeC.l PB_xine_port_send_gui_data(vo.l,tipo.l,dat.l) : Global xine_port_send_gui_data.PB_xine_port_send_gui_data =GetFunction(#MxineLib,"xine_port_send_gui_data")
     PrototypeC.l PB_xine_get_param(strea.l, param.l) : Global xine_get_param.PB_xine_get_param = GetFunction(#MxineLib,"xine_get_param")
    PrototypeC.l PB_xine_get_stream_info(strea.l, info.l) : Global xine_get_stream_info.PB_xine_get_stream_info =GetFunction(#MxineLib,"xine_get_stream_info")
   PrototypeC.l PB_xine_get_pos_length(strea.l,pos.l,pos_time.l,length_time.l) : Global xine_get_pos_length.PB_xine_get_pos_length =GetFunction(#MxineLib,"xine_get_pos_length")
   EndIf
 Else
 End
 EndIf
 ;
 *engine = xine_new();
 xine_init(*engine);
 ;
 *ap = xine_open_audio_driver(*engine, #Null, #Null);
 *vp = xine_open_video_driver(*engine, #Null,#XINE_VISUAL_TYPE_CACA,
 #Null);#XINE_VISUAL_TYPE_GTK
 ;
 *stream = xine_stream_new(*engine, *ap, *vp);
 ;
 xine_open(*stream,"meuvideo.mpg");
 ;
 Delay(20)
  xine_play(*stream,0,0);
  ;
  Debug "SAMPLERATE :"+ Str(xine_get_stream_info(*stream,
 #XINE_STREAM_INFO_AUDIO_SAMPLERATE))
   Debug "BITRATE :"+ Str(xine_get_stream_info(*stream,
 #XINE_STREAM_INFO_BITRATE))
   xine_get_pos_length(*stream, @pos_stream,@pos_time,@length_time)
 Debug pos_stream
 Debug pos_time
 Debug length_time
  ;
   Repeat
 Delay(20)
   ;xine_get_pos_length(*stream, @pos_stream,@pos_time,@length_time)
 ;Debug pos_stream
 ;Debug pos_time
 ;Debug length_time
   Until Quit = 1
   ;
 xine_close(*stream);
   If IsLibrary(#MxineLib)
     CloseLibrary(#MxineLib)
   EndIf
 End
edited by Rings, CodeTags