Re: DVDGetSubchannelLanguage() implementation

Sander Jansen <[email protected]> Wed, 28 Jul 2004 12:54:34 -0500
Newsgroups gmane.comp.video.ogle.devel
Organization fifthplanet.net
Message-ID <[email protected]>
Besides the extra function, what does this provide extra that 
DVDGetSubpictureAttributes doesn't provide?

	Sander

On Wednesday 28 July 2004 09:27 am, Seth Kingsley wrote:
> Index: ogle/dvdcontrol.c
> ===================================================================
> RCS file: /cvsroot/ogle/ogle/ogle/dvdcontrol.c,v
> retrieving revision 1.63
> diff -u -d -p -r1.63 dvdcontrol.c
> --- ogle/dvdcontrol.c	10 Aug 2003 21:15:07 -0000	1.63
> +++ ogle/dvdcontrol.c	28 Jul 2004 14:22:42 -0000
> @@ -959,7 +959,35 @@ DVDResult_t DVDGetSubpictureLanguage(DVD
>  				     DVDSubpictureStream_t StreamNr,
>  				     DVDLangID_t *const Language)
>  {
> -  return DVD_E_NotImplemented;
> +  MsgEvent_t ev;
> +  int32_t serial;
> +  ev.type = MsgEventQDVDCtrl;
> +  DVD_SETSERIAL(nav, ev.dvdctrl.cmd);
> +  serial = ev.dvdctrl.cmd.any.serial;
> +  ev.dvdctrl.cmd.type = DVDCtrlGetSubpictureLanguage;
> +  ev.dvdctrl.cmd.subpicturelanguage.streamnr = StreamNr;
> +
> +  if(MsgSendEvent(nav->msgq, nav->client, &ev, 0) == -1) {
> +    return DVD_E_FailedToSend;
> +  }
> +
> +  while(1) {
> +    if(MsgNextEvent(nav->msgq, &ev) == -1) {
> +      return DVD_E_Unspecified;
> +    }
> +    if((ev.type == MsgEventQDVDCtrl) &&
> +       (ev.dvdctrl.cmd.type == DVDCtrlRetVal) &&
> +       (ev.dvdctrl.cmd.retval.serial == serial)) {
> +      return ev.dvdctrl.cmd.retval.val;
> +    }
> +    if((ev.type == MsgEventQDVDCtrl) &&
> +       (ev.dvdctrl.cmd.type == DVDCtrlSubpictureLanguage)) {
> +      if(ev.dvdctrl.cmd.subpictureattributes.streamnr == StreamNr) {
> +	*Language = ev.dvdctrl.cmd.subpicturelanguage.langid;
> +	return DVD_E_Ok;
> +      }
> +    }
> +  }
>  }
>
>
> Index: ogle/dvdevents.h
> ===================================================================
> RCS file: /cvsroot/ogle/ogle/ogle/dvdevents.h,v
> retrieving revision 1.33
> diff -u -d -p -r1.33 dvdevents.h
> --- ogle/dvdevents.h	23 Feb 2003 17:45:38 -0000	1.33
> +++ ogle/dvdevents.h	28 Jul 2004 14:22:43 -0000
> @@ -93,6 +93,8 @@ typedef enum {
>    DVDCtrlIsSubpictureStreamEnabled,
>    DVDCtrlSubpictureStreamEnabled,
>
> +  DVDCtrlGetSubpictureLanguage,
> +  DVDCtrlSubpictureLanguage,
>    DVDCtrlGetSubpictureAttributes,
>    DVDCtrlSubpictureAttributes,
>
> @@ -349,6 +351,13 @@ typedef struct {
>    DVDCtrlEventType_t type;
>    int32_t serial;
>    DVDSubpictureStream_t streamnr;
> +  DVDLangID_t langid;
> +} DVDCtrlSubpictureLanguageEvent_t;
> +
> +typedef struct {
> +  DVDCtrlEventType_t type;
> +  int32_t serial;
> +  DVDSubpictureStream_t streamnr;
>    DVDSubpictureAttributes_t attr;
>  } DVDCtrlSubpictureAttributesEvent_t;
>
> @@ -442,6 +451,7 @@ typedef union {
>
>    DVDCtrlCurrentSubpictureEvent_t currentsubpicture;
>    DVDCtrlSubpictureStreamEnabledEvent_t subpicturestreamenabled;
> +  DVDCtrlSubpictureLanguageEvent_t subpicturelanguage;
>    DVDCtrlSubpictureAttributesEvent_t subpictureattributes;
>    DVDCtrlCurrentAngleEvent_t currentangle;
>
> Index: vmg/com.c
> ===================================================================
> RCS file: /cvsroot/ogle/ogle/vmg/com.c,v
> retrieving revision 1.27
> diff -u -d -p -r1.27 com.c
> --- vmg/com.c	13 Sep 2003 17:40:09 -0000	1.27
> +++ vmg/com.c	28 Jul 2004 14:22:44 -0000
> @@ -170,6 +170,7 @@ void handle_events(MsgEventQ_t *msgq, Ms
>        case DVDCtrlGetAudioAttributes:
>        case DVDCtrlGetCurrentSubpicture:
>        case DVDCtrlIsSubpictureStreamEnabled:
> +      case DVDCtrlGetSubpictureLanguage:
>        case DVDCtrlGetSubpictureAttributes:
>        case DVDCtrlGetCurrentAngle:
>        case DVDCtrlGetState:
> Index: vmg/nav.c
> ===================================================================
> RCS file: /cvsroot/ogle/ogle/vmg/nav.c,v
> retrieving revision 1.99
> diff -u -d -p -r1.99 nav.c
> --- vmg/nav.c	7 Mar 2004 10:44:33 -0000	1.99
> +++ vmg/nav.c	28 Jul 2004 14:22:47 -0000
> @@ -1009,6 +1009,20 @@ int process_user_data(MsgEvent_t ev, pci
>        MsgSendEvent(msgq, ev.any.client, &send_ev, 0);
>      }
>      break;
> +  case DVDCtrlGetSubpictureLanguage:
> +    {
> +      MsgEvent_t send_ev;
> +      int streamN = ev.dvdctrl.cmd.subpicturelanguage.streamnr;
> +      send_ev.type = MsgEventQDVDCtrl;
> +      send_ev.dvdctrl.cmd.type = DVDCtrlSubpictureLanguage;
> +      send_ev.dvdctrl.cmd.subpicturelanguage.streamnr = streamN;
> +      {
> +	subp_attr_t attr = vm_get_subp_attr(streamN);
> +	send_ev.dvdctrl.cmd.subpicturelanguage.langid = attr.lang_code;
> +	MsgSendEvent(msgq, ev.any.client, &send_ev, 0);
> +      }
> +    }
> +    break;
>    case DVDCtrlGetSubpictureAttributes: // FIXME XXX $$$ Not done
>      {
>        MsgEvent_t send_ev;

-- 
"Nervous hands grip tight the knife
In the darkness, till the cake is cut"
	- Peter Gabriel