LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 03-20-2013, 03:52 PM   #1
tbillion
LQ Newbie
 
Registered: Mar 2013
Distribution: Linux Mint, OpenSUSE, Arch, Debian
Posts: 11

Rep: Reputation: Disabled
HELP Please :) Looking for a couple pointers, SDL, C++, Mplayer?


ok im going to try not to ramble, but i rarely succeed.

I am working on makking an aplication in C++, that currently uses sdl to render a gui for my 5 year old to watch her favorite shows in her room with the input of ONLY a Ps 2 controller from the goodwill store

what i have done is built a plat form based on a Neoware thin client that has simple frame buffer output, built a menu application in C++ that uses libsdl to grab a bunch of images and make a picture driven menu i cant post attachements but it looks decent

where i am at now is how to play the vid clips in my application, I would prefer Mplayer becasue in my opinion it is a simple clean solution but i am open to others that will work

CAVIATS (catch 22) the platform does not have nor will it have X due to processor power and space requirements i am working pure tty terminal. so any solution relying on X (which would be simple) just isnt gonna work. the system is 700mhz and has a fixed size 1GB SSD. Also Nay sayers please leave the nay for the horses becasue i am already using a scrip version that will play all the episodes and it works fine the problem is i want for her to be able to use it to change the ep etc.

Suggestions. I would like to render either directly to the same sdl surface or if i have to spawn a child i need it always to go back to the menu when it releases said media player.. open to alllllll suggesstions. Fluent in C++, shell scripts and alot of other languages. also i dont want a java solution.

THanks in ADV.
 
Old 03-21-2013, 05:46 AM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
mplayer -ao sdl -vo sdl ??

Just tried it in a console here (Outside of X) and it didn't complain about a lack of X. If it needed X I'd have got the usual "Can't find DISPLAY::0" error.
 
Old 03-22-2013, 12:03 PM   #3
tbillion
LQ Newbie
 
Registered: Mar 2013
Distribution: Linux Mint, OpenSUSE, Arch, Debian
Posts: 11

Original Poster
Rep: Reputation: Disabled
hmm gimme about an hour or so to play around withit in an actual console with my program but i was pretty sure the other day that didnt work for some reason, lol, let me get back witht he reason


EDIT>>> I remeber now didnt even take an hour

k so when i issue this code

Code:
                    case SDLK_a:
                        system("mplayer -ao alsa -vo sdl \"mv1.mp4\"");
                    break;
I get a total system hang.On the machine I am codeing on there is obviously X and i am testing in tty1 which launches my sdl ap in tty8.

here is the whole code if you really wanna read it >>>

Code:
#include <cstdlib>
#include <SDL/SDL.h>
#include "SDL_gfxPrimitives.h"
#include "SDL/SDL_image.h"
#include <string>
#include <iostream>
using namespace std;
#include <math.h>
#include <unistd.h>
#include <ftw.h>
#include <fnmatch.h>

#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    int rmask = 0xff000000;
    int gmask = 0x00ff0000;
    int bmask = 0x0000ff00;
    int amask = 0x000000ff;
#else
    int rmask = 0x000000ff;
    int gmask = 0x0000ff00;
    int bmask = 0x00ff0000;
    int amask = 0xff000000;
#endif

int cursorx=3;
int cursory=3;
int cursorp=1;
int Action=-1;
int scursorx=50;
int scursory=475;
int scursorp=1;


void Apply_Surface( int x, int y, SDL_Surface* source, SDL_Surface* destination ){

//Make a temporary rectangle to hold the offsets
SDL_Rect offset;

//Give the offsets to the rectangle
offset.x = x;
offset.y = y;

//Blit the surface
SDL_BlitSurface( source, NULL, destination, &offset );
}
void Apply_Clip( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL ) {
    //Holds offsets
    SDL_Rect offset;
    //Get offsets
    offset.x = x; offset.y = y;
    //Blit
    SDL_BlitSurface( source, clip, destination, &offset );
}

SDL_Surface *Load_CK_Image( std::string filename ){

 SDL_Surface* loadedImage = NULL;
 SDL_Surface* optimizedImage = NULL;

 loadedImage = IMG_Load( filename.c_str() );

 //If the image loaded
 if( loadedImage != NULL ) {
     //Create an optimized image
     optimizedImage = SDL_DisplayFormat( loadedImage );
     //Free the old image
     SDL_FreeSurface( loadedImage );
     //If the image was optimized just fine
     if( optimizedImage != NULL ) {
         //Map the color key
         Uint32 colorkey = SDL_MapRGB( optimizedImage->format, 0, 0x88, 0 );
          //Set all pixels of color R 0, G 0x88, B 0x00 to be transparent
          SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );
     }
     //Return the optimized image
     return optimizedImage;
  }
}
int MakeMainMenu(SDL_Surface* dst,int page=NULL){

        SDL_Surface* source = NULL;

// create blank surface for menu to be built on
        //source = SDL_CreateRGBSurface(SDL_HWSURFACE, dst->w, dst->h, 16, rmask, gmask, bmask, amask);
          source = SDL_CreateRGBSurface(SDL_HWSURFACE, dst->w, dst->h, 16, 0, 0, 0, 0);
          if(source == NULL) {
            fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
            exit(1);
          }

// load menu images
        SDL_Surface* aa1 = Load_CK_Image("aa1.png");
        SDL_Surface* aa2 = Load_CK_Image("aa2.png");
        SDL_Surface* aa3 = Load_CK_Image("aa3.png");
        SDL_Surface* aa4 = Load_CK_Image("aa4.png");
        SDL_Surface* aa5 = Load_CK_Image("aa5.png");
        SDL_Surface* aa6 = Load_CK_Image("aa6.png");
        SDL_Surface* aa7 = Load_CK_Image("aa7.png");
        SDL_Surface* buttons = Load_CK_Image("mbuttons.png");
//Create Clip Rectangeles for buttons
        SDL_Rect clip[ 16 ];
//Clip Zones for Button Sprties


    clip[ 0 ].x = 0;
    clip[ 0 ].y = 0;
    clip[ 0 ].w = 100;
    clip[ 0 ].h = 100;

    clip[ 1 ].x = 100;
    clip[ 1 ].y = 0;
    clip[ 1 ].w = 100;
    clip[ 1 ].h = 100;

    clip[ 2 ].x = 200;
    clip[ 2 ].y = 0;
    clip[ 2 ].w = 100;
    clip[ 2 ].h = 100;

    clip[ 3 ].x = 300;
    clip[ 3 ].y = 0;
    clip[ 3 ].w = 100;
    clip[ 3 ].h = 100;
/////////////////////////////row2
    clip[ 4 ].x = 0;
    clip[ 4 ].y = 100;
    clip[ 4 ].w = 100;
    clip[ 4 ].h = 100;

    clip[ 5 ].x = 100;
    clip[ 5 ].y = 100;
    clip[ 5 ].w = 100;
    clip[ 5 ].h = 100;

    clip[ 6 ].x = 200;
    clip[ 6 ].y = 100;
    clip[ 6 ].w = 100;
    clip[ 6 ].h = 100;

    clip[ 7 ].x = 300;
    clip[ 7 ].y = 100;
    clip[ 7 ].w = 100;
    clip[ 7 ].h = 100;
 ///////////////////////////row 3
    clip[ 8 ].x = 0;
    clip[ 8 ].y = 200;
    clip[ 8 ].w = 100;
    clip[ 8 ].h = 100;

    clip[ 9 ].x = 100;
    clip[ 9 ].y = 200;
    clip[ 9 ].w = 100;
    clip[ 9 ].h = 100;

    clip[ 10 ].x = 200;
    clip[ 10 ].y = 200;
    clip[ 10 ].w = 100;
    clip[ 10 ].h = 100;

    clip[ 11 ].x = 300;
    clip[ 11 ].y = 200;
    clip[ 11 ].w = 100;
    clip[ 11 ].h = 100;
/////////////////////////////row4
    clip[ 12 ].x = 0;
    clip[ 12 ].y = 300;
    clip[ 12 ].w = 100;
    clip[ 12 ].h = 100;

    clip[ 13 ].x = 100;
    clip[ 13 ].y = 300;
    clip[ 13 ].w = 100;
    clip[ 13 ].h = 100;

    clip[ 14 ].x = 200;
    clip[ 14 ].y = 300;
    clip[ 14 ].w = 100;
    clip[ 14 ].h = 100;

    clip[ 15 ].x = 300;
    clip[ 15 ].y = 300;
    clip[ 15 ].w = 100;
    clip[ 15 ].h = 100;


// draw menu

        boxRGBA(source,10,10,220,220,255,0,0,150);
        boxRGBA(source,230,10,440,220,255,0,0,150);
        boxRGBA(source,450,10,660,220,255,0,0,150);
        boxRGBA(source,670,10,880,220,255,0,0,150);
        boxRGBA(source,10,230,220,440,255,0,0,150);
        boxRGBA(source,230,230,440,440,255,0,0,150);
        boxRGBA(source,450,230,660,440,255,0,0,150);
        boxRGBA(source,670,230,880,440,255,0,0,150);



        Apply_Surface(15,15,aa1,source);
        Apply_Surface(235,15,aa2,source);
        Apply_Surface(455,15,aa3,source);
        Apply_Surface(675,15,aa4,source);
        Apply_Surface(15,235,aa5,source);
        Apply_Surface(235,235,aa6,source);
        Apply_Surface(455,235,aa7,source);

        Apply_Clip(50,475,buttons,source, &clip[ 0 ]);
        Apply_Clip(150,475,buttons,source, &clip[ 8 ]);
        Apply_Clip(250,475,buttons,source, &clip[ 9 ]);
        Apply_Clip(350,475,buttons,source, &clip[ 10 ]);
        Apply_Clip(450,475,buttons,source, &clip[ 11 ]);
        Apply_Clip(550,475,buttons,source, &clip[ 12 ]);
        Apply_Clip(650,475,buttons,source, &clip[ 13 ]);
        Apply_Clip(750,475,buttons,source, &clip[ 14 ]);
        //apply_surface( 0, 0, dots, screen, &clip[ 0 ] );

        Apply_Surface(0,0,source,dst);
        SDL_FreeSurface(source);
        SDL_FreeSurface(aa1);
        SDL_FreeSurface(aa2);
        SDL_FreeSurface(aa3);
        SDL_FreeSurface(aa4);
        SDL_FreeSurface(aa5);
        SDL_FreeSurface(aa6);
        SDL_FreeSurface(aa7);
//        SDL_FreeSurface();

}

int MovePlaceCursor(SDL_Surface* dst){

    SDL_Surface* msk = Load_CK_Image("msk.png");
    Apply_Surface(cursorx,cursory,msk,dst);
    SDL_FreeSurface(msk);


}

int SetCursorP(){

int wv1;
int wv2;
int wv3;

wv1=(cursorx / 220)+1;
wv2=((cursory / 220)*4);

wv3=wv1+wv2;

//printf("w1:%d w2:%d wv3: %d \n",wv1,wv2,wv3);

}
int SubMenuPos(){

int wv1=0;

wv1 = ((scursorx - 50)/100)+1;

return wv1;

}

bool SubInputProcess(SDL_Surface* dst){
    bool done = false;
    Action = -1;
    SDL_Surface* source = NULL;
    SDL_Surface* menuold = NULL;
     // create blank surface to haze selection
        //source = SDL_CreateRGBSurface(SDL_HWSURFACE, dst->w, dst->h, 16, rmask, gmask, bmask, amask);
          source = SDL_CreateRGBSurface(SDL_HWSURFACE, 220, 220, 16,255,255, 255, 255);
          if(source == NULL) {
            fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
            exit(1);
          }

       boxRGBA(source,0,0,220,220,0,0,0,150);
       Apply_Surface(cursorx,cursory,source,dst);
       menuold = SDL_DisplayFormat(dst);
       SDL_Surface* smsk = Load_CK_Image("smsk.png");
       Apply_Surface(50,475,smsk,dst);

       while(Action=-1){
        // message processing loop
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
            {
                // exit if the window is closed
            case SDL_QUIT:
                done = true;
                break;

                // check for keypresses
            case SDL_KEYDOWN:
                {

                    switch(event.key.keysym.sym){
                    // exit if ESCAPE is pressed
                    case SDLK_ESCAPE:
                        done = true;
                    break;

                    // exit if LEFT is pressed
                    case SDLK_LEFT:
                        scursorx = scursorx - 100;
                        if (scursorx < 50){scursorx=50;}
                    break;
                    // exit if RIGHT is pressed
                    case SDLK_RIGHT:
                        scursorx = scursorx + 100;
                        if (scursorx > 750){scursorx=750;}
                    break;
                    // exit if DOWN is pressed
                    case SDLK_RETURN:
                       // SubInputProcess();
                       Action = scursorp;
                       if (Action == scursorp){return done;}
                    break;




                    }

                }
            } // end switch
        } // end of message processing
        Apply_Surface(0,0,menuold,dst);
        Apply_Surface(scursorx,scursory,smsk,dst);
        scursorp = SubMenuPos();

        //output image/???
        SDL_Flip(dst);
        if (done == true){return done;}

       }

}

bool MainInputProcess(SDL_Surface* dst){

bool done = false;
        // message processing loop
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
            {
                // exit if the window is closed
            case SDL_QUIT:
                done = true;
                break;

                // check for keypresses
            case SDL_KEYDOWN:
                {

                    switch(event.key.keysym.sym){
                    // exit if ESCAPE is pressed
                    case SDLK_ESCAPE:
                        done = true;
                    break;

                    // exit if LEFT is pressed
                    case SDLK_LEFT:
                        cursorx = cursorx - 220;
                        if (cursorx < 10){cursorx=3;}
                    break;
                    // exit if RIGHT is pressed
                    case SDLK_RIGHT:
                        cursorx = cursorx + 220;
                        if (cursorx > 675){cursorx=663;}
                    break;
                    // exit if UP is pressed
                    case SDLK_UP:
                        cursory = cursory - 220;
                        if (cursory < 10){cursory=3;}
                    break;
                    // exit if DOWN is pressed
                    case SDLK_DOWN:
                        cursory = cursory + 220;
                        if (cursory > 300){cursory=223;}
                    break;
                    // exit if DOWN is pressed
                    case SDLK_RETURN:
                        done = SubInputProcess(dst);
                    break;
                    case SDLK_a:
                        system("mplayer -ao alsa -vo sdl \"mv1.mp4\"");
                    break;



                    }

                }
            } // end switch
        } // end of message processing


return done;
}


int main ( int argc, char** argv )
{
    // initialize SDL video
    SDL_Init(SDL_INIT_EVERYTHING);
    // make sure SDL cleans up before exit
    atexit(SDL_Quit);
    // create a new window
    SDL_Surface* screen = SDL_SetVideoMode(0,0, 16,SDL_HWSURFACE|SDL_DOUBLEBUF);




    int n=0;
    int x1=10;
    int y1=10;
    int x2=10;
    int y2=10;


    // program main loop
    bool done = false;
    while (!done)
    {
        done = MainInputProcess(screen);
        // DRAWING STARTS HERE

        // clear screen
        SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));

        MakeMainMenu(screen);
        MovePlaceCursor(screen);
        SetCursorP();



        // DRAWING ENDS HERE

        // finally, update the screen :)
        SDL_Flip(screen);
    } // end main loop

    // free loaded bitmap

    // all is well ;)
    printf("Exited cleanly\n");
    return 0;
}
Also if i just type that into a console i get >> bla bla bla "SDL_SetVideoMode Failed" bla bla bla (bla is a technical term btw )

EDIT>>>

googled to see if i could remedy this y google search was

::: mplayer sdl SDL_SetVideoMode Failed :::
the search returned a mail list with this semi solution, but it didnt work for the direct command line one either.

>> The SDL's pkg-message says we can use video driver in tty terminal.
>>
>> To do this you have to load the vesa kernel module or enable it in your
>> kernel, and set environment variable "SDL_VIDEODRIVER=vgl".
>>
>> I tried it with mplayer :
>>
>> $ SDL_VIDEODRIVER=vgl; export SDL_VIDEODRIVER
>> $ mplayer -vo sdl<the file here>

so im gonna keep trying let you know what i find.

Last edited by tbillion; 03-22-2013 at 12:42 PM.
 
Old 03-22-2013, 01:02 PM   #4
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
The _last_ thing I want to do is read code. Sorry if I gave that impression.

In your honour, I exited X. It should not be playing on tty8. This console playing freaked the keyboard and mouse input to mplayer, gave me no border, just a black screen with a video as-is size wise. But it worked. Here's the output.
Code:
VIDEO:  [H264]  512x288  24bpp  30.000 fps  517.1 kbps (63.1 kbyte/s)
Clip info:
 major_brand: mp42
 minor_version: 1
 compatible_brands: isomiso2avc1mp41mp423gp5
 creation_time: 1970-01-01 00:00:00
 encoder: Lavf52.62.0
Load subtitles in ./
[VO_SDL] Using driver: fbcon.
vo: couldn't open the X11 display ()!
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.21.101 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 65.5 kbit/4.64% (ratio: 8187->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
AO: [sdl] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [sdl] 512x288 => 512x288 Planar YV12
w/h: 512 288
No bind found for key 'F5'.32 ct:  0.031   0/  0  3%  9%  0.3% 0 0
Exiting... (End of file)
I wouldn't recommend it as an answer. Like, if you handed that up for some exam and I was marking it, you would not do well :-/. It's probably an mplayer.conf thing that's stopping you. If it did not have access to a console framebuffer, it probably wouldn't run. As you see, I have slackware.
 
Old 03-22-2013, 02:55 PM   #5
tbillion
LQ Newbie
 
Registered: Mar 2013
Distribution: Linux Mint, OpenSUSE, Arch, Debian
Posts: 11

Original Poster
Rep: Reputation: Disabled
Hey thanks for that ill examine my mplayer.conf, and i do have a framebuffer on this laptop as well as the target device .

as for the code thing np, sometimes in forums they ask you for the code, so i figured to cut the head from the snake first and just put the code.

as for tty8; when i am running tty7 as X11 the sdl program appears in tty8.
i am programming it on a laptop with x11 the target is a x11 free platform.

Quote:
I wouldn't recommend it as an answer. Like, if you handed that up for some exam and I was marking it, you would not do well :-/.
not sure where you were going with this? this application is for my 5 year old daughter so she can watch all her fav cartoons without my interation of individual episode changes. THank you for the help though i am gonna take a look at that conf. file and ill post what i find.

even if i can command line the mplayer however im not undertanding how it will layer itself over the running sdl/c++ application like i say i am trying for an entire console based media player i suppose you could say, XBMC but for old slow hardware, i mean the raspberry pi has more power than my platform.


EDIT>> HA! this machine that im developing on didnt have mplayer on it but rather mplayer2 and apparently mplayer2 has some problem with sdl and fb out (at least on here) so i installed mplayer and typed : mplayer -vo sdl -ao sdl -vf scale=1366x768 mv1.mp4 and wala full screen sdl out ... now im walking in the right direction.

well still no real luck on geting the mplayer to work, however i have got it to where it will automatically detect the framebuffersize and set the application size to the screen size plus one for me

Last edited by tbillion; 03-22-2013 at 05:06 PM.
 
Old 03-23-2013, 05:38 AM   #6
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Quote:
I wouldn't recommend it as an answer. Like, if you handed that up for some exam and I was marking it, you would not do well :-/.
not sure where you were going with this? this application is for my 5 year old daughter so she can watch all her fav cartoons without my interation of individual episode changes.
Fine. I had a 512x288 video in the middle of a 1600x900 screen with no real control and no border. I couldn't even quit, as esc or q didn't work as usual. The Raspberry pi needs you to use omxplayer - because only that will speak to the graphics card fast enough. It is a cheap alternative, as long as you don't need java of flash to download. I presume you have done interesting things to your ps2 for her.
 
Old 03-23-2013, 11:33 AM   #7
tbillion
LQ Newbie
 
Registered: Mar 2013
Distribution: Linux Mint, OpenSUSE, Arch, Debian
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
I had a 512x288 video in the middle of a 1600x900 screen with no real control and no border.I couldn't even quit, as esc or q didn't work as usual.
well the thing about mplayer is that its all keyboard based controls at that point in terminal if you modified your command to include -vf scale=1600:900 it would have been full screen. but thats cool i dont think you have intentions to use it like that again as for the quit thing q seems to do it for me. but idk thats the porb with linux too many cooks in one kitchen we all start with the same ingredients but all have something different

Quote:
The Raspberry pi needs you to use omxplayer - because only that will speak to the graphics card fast enough. It is a cheap alternative, as long as you don't need java of flash to download.
actually i have seen a rpi run mplayer with frame drop and autosync enables with a disrto of arch linux, a friend of mine has it as a kiosk in his home improvement store to explain products user driven menues that play different movies, i designed the shell script for it to work. rpi can still run frame buffer and i mean these cartoons and any thing else that you would do on that platform obviously is not 1080 hi def.

Quote:
I presume you have done interesting things to your ps2 for her.
Na, I just love the controllers Sony had it right when they made that controller, the feel is right the number of buttons is good, and here in the second hand stores you can get them for a $1.99USD which for arduino or PIC projects soent make me feel bad chopping um up or burning them up or in general destroying them.

as for this project i have an adapter like this one that makes a js0 and js1 device on my machine, from there sdl does the joystick magic and renders a menu with movable cursor. i am really in the last couple legs of the project, i been working on it for about 6 hours total. the plat for that it runs on is a clientNeoware Ca10 thinclient. i only paid for the adapter and the controller thin client and all the adapter hard ware for the vid signal $35, so pretty good in my mind.

the vid signal actually goes through a vga to composite adapter and then to a composite to rf adapter. that is the part that gives me the most problems but my daughter only has an old tube tv. so it works.


General question:
any how as far as this thing is concerned i still cant get it to execute mplayer total system hang, do i have to use fork or something to get it to put up my player?

EDIT >> ok so after doing some tweaks and trying out fork, i have some better progress but im still stuck. i added a fork code to the program:

Code:
int PlaySingleFile(){


  int status;
   pid_t  pid;
   pid_t result;




   /* Output from both the child and the parent process
    * will be written to the standard output,
    * as they both run at the same time.
    */
   pid = fork();

   if (pid == -1)
   {
      /* Error:
       * When fork() returns -1, an error happened
       * (for example, number of processes reached the limit).
       */
      fprintf(stderr, "can't fork, error %d\n", errno);
      exit(EXIT_FAILURE);
   }
   else if (pid == 0)
   {
      /* Child process:
       * When fork() returns 0, we are in
       * the child process.

      int  j;
      for (j = 0; j < 10; j++)
      {
         printf("child: %d\n", j);
         sleep(1);
      }*/
        //sprintf(buffer,"mplayer -ao sdl -vo sdl -vf scale=200:200 /home/cthayn/fishguage/roseputer/bin/Debugmv1.mp4",TRUE_Screen_X,TRUE_Screen_Y);
        //system call
        system("mplayer -ao alsa -vo fbdev -vf scale=200:200 /home/cthayn/fishguage/roseputer/bin/Debug/mv1.mp4");

      _exit(0);  /* Note that we do not use exit() */
   }
   else
   {
      /* When fork() returns a positive number, we are in the parent process
       * (the fork return value is the PID of the newly created child process)
       * Again we count up to ten.
       */
      result = waitpid(pid, &status, WNOHANG);
      while (result == 0)
      {
       result = waitpid(pid, &status, WNOHANG);
       if (result == 0) {
       // Child still alive
       printf("it breathes\n");
        } else if (result == -1) {
        // Error
        } else {
        printf("it died\n");
        // Child exited
        }
      }
      //exit(0);
   }
   return 0;
}
im not sure if this is even needed but im still no dice, what it does now is it hangs but it comes back and will move the mouse every 10 secs or so. still no sound or video, and once you execute the code all ctrl+alt+F1-9 doesnt work niether does esc or q for quit. also changed the mplayer out from sdl to fbdev to see if it would render over my menu and no dice. gonna try a couple other things brb.

Last edited by tbillion; 03-23-2013 at 02:36 PM.
 
Old 03-23-2013, 12:37 PM   #8
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
rpi will play mplayer but for full screen hdmi and quality you need omxplayer.

If you compile mplayer from source, you can do it --without-x, I am fairly sure. It will cry foul and disable a lot of stuff, but what you have left should go. I presume you can compile for ps2? Mebbe with a joystick :-)).
 
Old 03-24-2013, 04:01 PM   #9
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Just FYI, I tried this on a second laptop here, and it doesn't work for love or money. Can't get video in a console.

WORKS:
Samsung laptop, intel chipset & hd4000 graphics running Slackware-14.0 (3.7.1 kernel). OSS graphics. If there is a binary blob I haven't got it.

DOESN'T WORK:
HP 6715S, AMD chipset, ATI graphics (rs690m video = x1250 series = at least 2 other AMD names). 3.2.29 kernel. That video is a piece of <expletive deleted> from 2007 and only works on OSS graphics.

What's interesting about that is that with the exception of the kernel (Not stock kernel in either case) the distro, compiles and versions are the same. Only graphics is different.

This seems to point the finger at your graphics capability, not your code.
 
Old 03-27-2013, 12:40 PM   #10
tbillion
LQ Newbie
 
Registered: Mar 2013
Distribution: Linux Mint, OpenSUSE, Arch, Debian
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
Just FYI, I tried this on a second laptop here, and it doesn't work for love or money. Can't get video in a console.

WORKS:
Samsung laptop, intel chipset & hd4000 graphics running Slackware-14.0 (3.7.1 kernel). OSS graphics. If there is a binary blob I haven't got it.

DOESN'T WORK:
HP 6715S, AMD chipset, ATI graphics (rs690m video = x1250 series = at least 2 other AMD names). 3.2.29 kernel. That video is a piece of <expletive deleted> from 2007 and only works on OSS graphics.

What's interesting about that is that with the exception of the kernel (Not stock kernel in either case) the distro, compiles and versions are the same. Only graphics is different.

This seems to point the finger at your graphics capability, not your code.

yay i dont have shitty code thats a relief


so the case your saying here is it happens to be part of the command i am using for execution of the mplayer command the -vo switch. in my console if i manually type it in it runs it also works with x11 but as soon as i dispatch the command from the program the whole system hangs. cant xplain it, gonna spend this afternoon implementing fork() exec() call.
 
Old 03-27-2013, 06:42 PM   #11
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,773

Rep: Reputation: 197Reputation: 197
Try
Code:
mplayer -vo fbdev2 -vf scale=160:120 file.mp4
 
Old 03-28-2013, 05:49 AM   #12
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Quote:
Originally Posted by tbillion View Post
yay i dont have shitty code thats a relief
You said that - I didn't :-)).
Quote:
Originally Posted by tbillion View Post
so the case your saying here is it happens to be part of the command i am using for execution of the mplayer command the -vo switch. in my console if i manually type it in it runs it also works with x11 but as soon as i dispatch the command from the program the whole system hangs. cant xplain it, gonna spend this afternoon implementing fork() exec() call.
I don't think so. It may be that, I've been wrong before(!!), but not everything is implemented in each graphics driver. Intel, for example, hasn't implemented OpenCL. What is actually implemented in your PS2 video driver? That's the question I'd investigate. If it doesn't handle fbdev or sdl, your idea is dead. I also discovered that the controls exist, just are different - mixed up. Quit is y, & mute = spacebar.

I think another issue _may_ be that with kms in the kernel, and no X, it suddenly goes back to the kernel module to do stuff. What are it's capabilities?
 
Old 03-28-2013, 06:04 AM   #13
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Quote:
Originally Posted by teckk View Post
Try
Code:
mplayer -vo fbdev2 -vf scale=160:120 file.mp4
Dutifully tried therm here. Works on both laptops, but the prescaling barfs. I used a wmv and got this error
Quote:
[Requested video codec family [wmvdmo] (vfm=dmo) not available.
Enable it at compilation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Silent SDL Parachute Death: Pointers on how I should go about fixing this problem. RHLinuxGUY Programming 3 05-24-2006 01:33 AM
ubuntu 5.10 x86_64: mplayer/xine/... stop playing video after a couple of frames Tinkster Ubuntu 2 01-10-2006 02:13 PM
Sourcecompiling Problem...The sdl-config script installed by SDL could not be found. deepclutch Debian 1 12-15-2005 01:15 PM
Trying to program an SDL application but cannot find the SDL.h file:SuSE 9.2&KDevelop pujolasdf Linux - Newbie 4 03-13-2005 08:50 AM
brightness with mplayer using -vo sdl? h8r Linux - Software 2 11-07-2003 09:24 AM


All times are GMT -5. The time now is 09:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration