Thread: [Redbutton-devel] SF.net SVN: redbutton:[506] redbutton-browser/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2008-12-05 16:36:43
|
Revision: 506
http://redbutton.svn.sourceforge.net/redbutton/?rev=506&view=rev
Author: skilvington
Date: 2008-12-05 16:36:37 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
allow user to choose the ALSA audio device
Modified Paths:
--------------
redbutton-browser/trunk/MHEGAudioOutput.c
redbutton-browser/trunk/MHEGAudioOutput.h
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/rb-browser.c
Modified: redbutton-browser/trunk/MHEGAudioOutput.c
===================================================================
--- redbutton-browser/trunk/MHEGAudioOutput.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGAudioOutput.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -12,15 +12,15 @@
#include "utils.h"
bool
-MHEGAudioOutput_init(MHEGAudioOutput *a)
+MHEGAudioOutput_init(MHEGAudioOutput *a, char *alsa_dev)
{
int err;
a->ctx = NULL;
- if((err = snd_pcm_open(&a->ctx, ALSA_AUDIO_DEVICE, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
+ if((err = snd_pcm_open(&a->ctx, alsa_dev, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
{
- error("Unable to open audio device '%s': %s", ALSA_AUDIO_DEVICE, snd_strerror(err));
+ error("Unable to open audio device '%s': %s", alsa_dev, snd_strerror(err));
return false;
}
Modified: redbutton-browser/trunk/MHEGAudioOutput.h
===================================================================
--- redbutton-browser/trunk/MHEGAudioOutput.h 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGAudioOutput.h 2008-12-05 16:36:37 UTC (rev 506)
@@ -15,9 +15,9 @@
} MHEGAudioOutput;
/* default ALSA device */
-#define ALSA_AUDIO_DEVICE "default"
+#define DEFAULT_ALSA_DEVICE "default"
-bool MHEGAudioOutput_init(MHEGAudioOutput *);
+bool MHEGAudioOutput_init(MHEGAudioOutput *, char *);
void MHEGAudioOutput_fini(MHEGAudioOutput *);
bool MHEGAudioOutput_setParams(MHEGAudioOutput *, snd_pcm_format_t, unsigned int, unsigned int);
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGEngine.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -173,6 +173,7 @@
MHEGDisplay_init(&engine.display, opts->fullscreen, opts->keymap, opts->verbose);
+ engine.audio_dev = safe_strdup(opts->audio_dev);
engine.vo_method = MHEGVideoOutputMethod_fromString(opts->vo_method);
engine.av_disabled = opts->av_disabled;
@@ -321,6 +322,12 @@
return &engine.display;
}
+char *
+MHEGEngine_getAudioOutputDevice(void)
+{
+ return engine.audio_dev;
+}
+
MHEGVideoOutputMethod *
MHEGEngine_getVideoOutputMethod(void)
{
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGEngine.h 2008-12-05 16:36:37 UTC (rev 506)
@@ -88,6 +88,7 @@
int verbose; /* -v flag */
unsigned int timeout; /* seconds to poll for missing content before generating a ContentRefError */
bool fullscreen; /* scale to fullscreen? */
+ char *audio_dev; /* ALSA audio device name */
char *vo_method; /* MHEGVideoOutputMethod name (NULL for default) */
bool av_disabled; /* true => audio and video output totally disabled */
char *keymap; /* keymap config file to use (NULL for default) */
@@ -171,6 +172,7 @@
int verbose; /* -v cmd line flag */
unsigned int timeout; /* how long to poll for missing content before generating an error */
MHEGDisplay display; /* make porting easier */
+ char *audio_dev; /* audio device name */
MHEGVideoOutputMethod *vo_method; /* video output method (resolved from name given in MHEGEngineOptions) */
bool av_disabled; /* true => video and audio output totally disabled */
MHEGBackend backend; /* local or remote access to DSMCC carousel and MPEG streams */
@@ -193,6 +195,7 @@
void MHEGEngine_fini(void);
MHEGDisplay *MHEGEngine_getDisplay(void);
+char *MHEGEngine_getAudioOutputDevice(void);
MHEGVideoOutputMethod *MHEGEngine_getVideoOutputMethod(void);
bool MHEGEngine_avDisabled(void);
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -898,7 +898,7 @@
}
/* even if this fails, we still need to consume the audioq */
- (void) MHEGAudioOutput_init(&ao);
+ (void) MHEGAudioOutput_init(&ao, MHEGEngine_getAudioOutputDevice());
/* assert - if audioq is not empty then the codec cannot be NULL */
if(p->audio_codec == NULL)
Modified: redbutton-browser/trunk/rb-browser.c
===================================================================
--- redbutton-browser/trunk/rb-browser.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/rb-browser.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -1,9 +1,10 @@
/*
- * rb-browser [-v] [-f] [-d] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-r] [<service_gateway>]
+ * rb-browser [-v] [-f] [-d] [-a <alsa_device>] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-r] [<service_gateway>]
*
* -v is verbose/debug mode
* -f is full screen, otherwise it uses a window
* -d disables all video and audio output
+ * -a changes the ALSA audio device, eg "hw" or "plughw", the default is "default"
* -o allows you to choose a video output method if the default is not supported/too slow on your graphics card
* (do 'rb-browser -o' for a list of available methods)
* -k changes the default key map to the given file
@@ -24,6 +25,7 @@
#include <limits.h>
#include "MHEGEngine.h"
+#include "MHEGAudioOutput.h"
#include "utils.h"
void usage(char *);
@@ -51,12 +53,13 @@
opts.srg_loc = DEFAULT_BACKEND;
opts.verbose = 0;
opts.fullscreen = false;
+ opts.audio_dev = DEFAULT_ALSA_DEVICE;
opts.vo_method = NULL;
opts.av_disabled = false;
opts.timeout = MISSING_CONTENT_TIMEOUT;
opts.keymap = NULL;
- while((arg = getopt(argc, argv, "rvfdo:k:t:")) != EOF)
+ while((arg = getopt(argc, argv, "rvfda:o:k:t:")) != EOF)
{
switch(arg)
{
@@ -76,6 +79,10 @@
opts.av_disabled = true;
break;
+ case 'a':
+ opts.audio_dev = optarg;
+ break;
+
case 'o':
opts.vo_method = optarg;
break;
@@ -125,6 +132,7 @@
"[-v] "
"[-f] "
"[-d] "
+ "[-a <alsa_device>] "
"[-o <video_output_method>] "
"[-k <keymap_file>] "
"[-t <timeout>] "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2009-01-22 16:51:03
|
Revision: 515
http://redbutton.svn.sourceforge.net/redbutton/?rev=515&view=rev
Author: skilvington
Date: 2009-01-22 16:50:57 +0000 (Thu, 22 Jan 2009)
Log Message:
-----------
ffmpeg includes have moved in newer versions of the libraries
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/mpegts.c
redbutton-browser/trunk/utils.h
redbutton-browser/trunk/videoout_xshm.c
redbutton-browser/trunk/videoout_xshm.h
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/MHEGDisplay.c 2009-01-22 16:50:57 UTC (rev 515)
@@ -13,8 +13,8 @@
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/keysym.h>
-#include <ffmpeg/avformat.h>
-#include <ffmpeg/swscale.h>
+#include <libavformat/avformat.h>
+#include <libswscale/swscale.h>
#include "MHEGEngine.h"
#include "MHEGDisplay.h"
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2009-01-22 16:50:57 UTC (rev 515)
@@ -8,8 +8,8 @@
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
-#include <ffmpeg/avformat.h>
-#include <ffmpeg/avcodec.h>
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
#include "ISO13522-MHEG-5.h"
#include "MHEGBackend.h"
Modified: redbutton-browser/trunk/mpegts.c
===================================================================
--- redbutton-browser/trunk/mpegts.c 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/mpegts.c 2009-01-22 16:50:57 UTC (rev 515)
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
-#include <ffmpeg/avformat.h>
+#include <libavformat/avformat.h>
#include "mpegts.h"
#include "utils.h"
Modified: redbutton-browser/trunk/utils.h
===================================================================
--- redbutton-browser/trunk/utils.h 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/utils.h 2009-01-22 16:50:57 UTC (rev 515)
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <stdarg.h>
-#include <ffmpeg/avformat.h>
+#include <libavformat/avformat.h>
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
Modified: redbutton-browser/trunk/videoout_xshm.c
===================================================================
--- redbutton-browser/trunk/videoout_xshm.c 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/videoout_xshm.c 2009-01-22 16:50:57 UTC (rev 515)
@@ -7,7 +7,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
-#include <ffmpeg/avformat.h>
+#include <libavformat/avformat.h>
#include "MHEGEngine.h"
#include "MHEGVideoOutput.h"
Modified: redbutton-browser/trunk/videoout_xshm.h
===================================================================
--- redbutton-browser/trunk/videoout_xshm.h 2009-01-19 09:23:56 UTC (rev 514)
+++ redbutton-browser/trunk/videoout_xshm.h 2009-01-22 16:50:57 UTC (rev 515)
@@ -8,8 +8,8 @@
#include <stdint.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
-#include <ffmpeg/avcodec.h>
-#include <ffmpeg/swscale.h>
+#include <libavcodec/avcodec.h>
+#include <libswscale/swscale.h>
typedef struct
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2010-08-24 16:32:42
|
Revision: 534
http://redbutton.svn.sourceforge.net/redbutton/?rev=534&view=rev
Author: skilvington
Date: 2010-08-24 16:32:36 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
libpng 1.4 updates. Patch from Andy Benton.
Modified Paths:
--------------
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/readpng.c
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2010-01-27 13:03:34 UTC (rev 533)
+++ redbutton-browser/trunk/MHEGEngine.c 2010-08-24 16:32:36 UTC (rev 534)
@@ -1589,7 +1589,7 @@
if(have_hook == false
|| (have_hook == true && hook == ContentHook_Bitmap_PNG)
- || (data->size >= 8 && png_check_sig(data->data, 8)))
+ || (data->size >= 8 && png_sig_cmp(data->data, 0, 8) == 0 ))
bitmap = MHEGDisplay_newPNGBitmap(&engine.display, data);
else if(have_hook == true && hook == ContentHook_Bitmap_MPEG)
bitmap = MHEGDisplay_newMPEGBitmap(&engine.display, data);
Modified: redbutton-browser/trunk/readpng.c
===================================================================
--- redbutton-browser/trunk/readpng.c 2010-01-27 13:03:34 UTC (rev 533)
+++ redbutton-browser/trunk/readpng.c 2010-08-24 16:32:36 UTC (rev 534)
@@ -67,7 +67,7 @@
png_bytepp row_pointers = NULL;
/* check the signature */
- if(!png_check_sig(png_data, 8))
+ if(png_sig_cmp(png_data, 0, 8) != 0)
return NULL;
/* init libpng data structures */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-02-28 17:04:34
|
Revision: 539
http://redbutton.svn.sourceforge.net/redbutton/?rev=539&view=rev
Author: skilvington
Date: 2011-02-28 17:04:27 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
allow non-destructive tuning, based on patch from John Williams
Modified Paths:
--------------
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/ResidentProgramClass.c
redbutton-browser/trunk/si.c
redbutton-browser/trunk/si.h
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2010-12-03 14:18:04 UTC (rev 538)
+++ redbutton-browser/trunk/MHEGEngine.c 2011-02-28 17:04:27 UTC (rev 539)
@@ -226,6 +226,8 @@
/* boot it */
verbose("Booting '%.*s'", boot_obj.size, boot_obj.data);
engine.quit_reason = QuitReason_DontQuit;
+ /* SI_TuneIndexInfo lifetime is per app, so reset to default value */
+ MHEGEngine_setTuneInfo(0);
/* load the app */
if((app = MHEGApp_loadApplication(&engine.active_app, &boot_obj)) == NULL)
return EXIT_FAILURE;
@@ -532,6 +534,20 @@
return &engine.active_app.scene->u.scene;
}
+int
+MHEGEngine_getTuneInfo(void)
+{
+ return engine.tuneinfo;
+}
+
+void
+MHEGEngine_setTuneInfo(int tuneinfo)
+{
+ engine.tuneinfo = tuneinfo;
+
+ return;
+}
+
/*
* adds the given object to the top of the DisplayStack for the active application
* (if it is not already in the DisplayStack)
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2010-12-03 14:18:04 UTC (rev 538)
+++ redbutton-browser/trunk/MHEGEngine.h 2011-02-28 17:04:27 UTC (rev 539)
@@ -30,23 +30,24 @@
/* EngineEvent EventTag values */
/* 0 and 1 are reserved */
-#define EngineEvent_GroupIDRefError 2
-#define EngineEvent_ContentRefError 3
-#define EngineEvent_TextKeyFunction 4
+#define EngineEvent_GroupIDRefError 2
+#define EngineEvent_ContentRefError 3
+#define EngineEvent_TextKeyFunction 4
/* 5 is reserved */
-#define EngineEvent_VideoPrefChanged 6
-#define EngineEvent_PauseResume 7
+#define EngineEvent_VideoPrefChanged 6
+#define EngineEvent_PauseResume 7
/* 8 is reserved */
-#define EngineEvent_NetworkBootInfo 9
-/* 10-15 are reserved */
-#define EngineEvent_CancelKeyFunction 16
+#define EngineEvent_NetworkBootInfo 9
+#define EngineEvent_NonDestructiveTuneOK 10
+/* 11-15 are reserved */
+#define EngineEvent_CancelKeyFunction 16
/* 17-99 are reserved */
-#define EngineEvent_RedKeyFunction 100
-#define EngineEvent_GreenKeyFunction 101
-#define EngineEvent_YellowKeyFunction 102
-#define EngineEvent_BlueKeyFunction 103
+#define EngineEvent_RedKeyFunction 100
+#define EngineEvent_GreenKeyFunction 101
+#define EngineEvent_YellowKeyFunction 102
+#define EngineEvent_BlueKeyFunction 103
/* from the NZ profile */
-#define EngineEvent_EPGKeyFunction 300
+#define EngineEvent_EPGKeyFunction 300
/* all other values are reserved */
/* EventTag key numbers for UserInput events */
@@ -188,6 +189,7 @@
LIST_OF(MHEGAction) *main_actionq; /* UK MHEG Profile event processing method */
LIST_OF(MHEGAction) *temp_actionq; /* UK MHEG Profile event processing method */
LIST_OF(PersistentData) *persistent; /* persistent files */
+ int tuneinfo; /* SI_TuneIndexInfo value */
} MHEGEngine;
/* prototypes */
@@ -207,6 +209,9 @@
ApplicationClass *MHEGEngine_getActiveApplication(void);
SceneClass *MHEGEngine_getActiveScene(void);
+int MHEGEngine_getTuneInfo(void);
+void MHEGEngine_setTuneInfo(int);
+
void MHEGEngine_addVisibleObject(RootClass *);
void MHEGEngine_removeVisibleObject(RootClass *);
void MHEGEngine_bringToFront(RootClass *);
Modified: redbutton-browser/trunk/ResidentProgramClass.c
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.c 2010-12-03 14:18:04 UTC (rev 538)
+++ redbutton-browser/trunk/ResidentProgramClass.c 2011-02-28 17:04:27 UTC (rev 539)
@@ -976,6 +976,8 @@
{
GenericInteger *serviceIndex_par;
int serviceIndex;
+ OctetString *service_url;
+ int tuneinfo;
if(!check_parameters(params, 1, Parameter_new_generic_integer)) /* in: serviceIndex */
{
@@ -986,21 +988,88 @@
serviceIndex_par = &(get_parameter(params, 1)->u.new_generic_integer);
serviceIndex = GenericInteger_getInteger(serviceIndex_par, caller_gid);
- (void) si_tune_index(serviceIndex);
+ /* what do we need to tune to */
+ if((service_url = si_get_url(serviceIndex)) == NULL)
+ {
+ error("ResidentProgram: SI_TuneIndex (TIn): invalid service index (%d)", serviceIndex);
+ return false;
+ }
+ /*
+ * see ES 202 184 v2.1.1, section 11.10.8.4 for details of the TuneInfo parameter
+ */
+ tuneinfo = MHEGEngine_getTuneInfo();
+ verbose("ResidentProgram: SI_TuneIndex: tuneinfo=%d", tuneinfo);
+
+ /* tuneinfo, bit 0: 'quiet' tune flag */
+ /* don't care */
+
+ /* tuneinfo, bit 1: destructive/non-destructive tune */
+ if((tuneinfo & 0x02) != 0)
+ {
+ /* non-destructive tune, ie current app keeps running */
+ ApplicationClass *current_app = MHEGEngine_getActiveApplication();
+ EventData event_tag;
+ verbose("ResidentProgram: SI_TuneIndex: non-destructive tune");
+ MHEGEngine_retune(service_url);
+ event_tag.choice = EventData_integer;
+ event_tag.u.integer = EngineEvent_NonDestructiveTuneOK;
+ MHEGEngine_generateAsyncEvent(¤t_app->rootClass.inst.ref, EventType_engine_event, &event_tag);
+ }
+ else
+ {
+ /* destructive tune, ie current app dies */
+ verbose("ResidentProgram: SI_TuneIndex: destructive tune");
+ MHEGEngine_quit(QuitReason_Retune, service_url);
+ }
+
+ /* tuneinfo, bit 2: explicit carousel ID flag */
+ if((tuneinfo & 0x04) == 0)
+ {
+ /* tuneinfo, bit 3: carousel ID mapping flag */
+ if((tuneinfo & 0x08) == 0)
+ {
+printf("TODO: SI_TuneIndex: tuneinfo=%d; use current carousel\n", tuneinfo);
+ }
+ else
+ {
+printf("TODO: SI_TuneIndex: tuneinfo=%d; use initial carousel\n", tuneinfo);
+ }
+ }
+ else
+ {
+ /* carousel ID is in bits 8-15 */
+printf("TODO: SI_TuneIndex: tuneinfo=%d; carousel ID=%d\n", tuneinfo, (tuneinfo >> 8) & 0xff);
+ }
+
+ /* tuneinfo, bit 4: broadcaster interrupt flag */
+ if((tuneinfo & 0x10) != 0)
+ {
+printf("TODO: SI_TuneIndex: tuneinfo=%d; disable broadcaster interrupt flag\n", tuneinfo);
+ }
+
return true;
}
bool
prog_SI_TuneIndexInfo(LIST_OF(Parameter) *params, OctetString *caller_gid)
{
+ GenericInteger *tuneinfo_par;
+ int tuneinfo;
+
if(!check_parameters(params, 1, Parameter_new_generic_integer)) /* in: tuneinfo */
{
error("ResidentProgram: SI_TuneIndexInfo (TII): wrong number or type of parameters");
return false;
}
-/* TODO */
-printf("TODO: program TII SI_TuneIndexInfo\n");
+
+ tuneinfo_par = &(get_parameter(params, 1)->u.new_generic_integer);
+ tuneinfo = GenericInteger_getInteger(tuneinfo_par, caller_gid);
+
+ verbose("ResidentProgram: SI_TuneIndexInfo(%d)", tuneinfo);
+
+ MHEGEngine_setTuneInfo(tuneinfo);
+
return true;
}
Modified: redbutton-browser/trunk/si.c
===================================================================
--- redbutton-browser/trunk/si.c 2010-12-03 14:18:04 UTC (rev 538)
+++ redbutton-browser/trunk/si.c 2011-02-28 17:04:27 UTC (rev 539)
@@ -93,20 +93,6 @@
return &si_channel[index];
}
-bool
-si_tune_index(int index)
-{
- if(index < 0 || index > si_max_index)
- {
- error("SI_TuneIndex: invalid service index (%d); range is 0-%d", index, si_max_index);
- return false;
- }
-
- MHEGEngine_quit(QuitReason_Retune, &si_channel[index]);
-
- return true;
-}
-
/*
* URL format is:
* dvb://original_network_id.[transport_id].service_id
Modified: redbutton-browser/trunk/si.h
===================================================================
--- redbutton-browser/trunk/si.h 2010-12-03 14:18:04 UTC (rev 538)
+++ redbutton-browser/trunk/si.h 2011-02-28 17:04:27 UTC (rev 539)
@@ -10,8 +10,6 @@
int si_get_index(OctetString *);
OctetString *si_get_url(int);
-bool si_tune_index(int);
-
unsigned int si_get_network_id(OctetString *);
unsigned int si_get_transport_id(OctetString *);
unsigned int si_get_service_id(OctetString *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-03-08 18:20:15
|
Revision: 542
http://redbutton.svn.sourceforge.net/redbutton/?rev=542&view=rev
Author: skilvington
Date: 2011-03-08 18:20:09 +0000 (Tue, 08 Mar 2011)
Log Message:
-----------
re-evaluate A/V PIDs on non-destructive tunes
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/ResidentProgramClass.c
redbutton-browser/trunk/StreamClass.c
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-04 16:53:56 UTC (rev 541)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-08 18:20:09 UTC (rev 542)
@@ -433,6 +433,29 @@
}
/*
+ * call this after a non-destructive retune
+ * if any StreamClass objects are active and playing A/V streams this will update their A/V PIDs to the new service
+ */
+
+void
+MHEGStreamPlayer_retuned(void)
+{
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
+
+ /* are we playing anything */
+ if(p->playing)
+ {
+ verbose("MHEGStreamPlayer: retuned while playing");
+ /* just stop and restart, when we start playing the A/V PIDs are recalculated */
+ MHEGStreamPlayer_stop(p);
+ MHEGStreamPlayer_play(p);
+ }
+
+ return;
+}
+
+/*
* decode_thread
* reads the MPEG TS file
* decodes the data into YUV video frames and audio samples
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2011-03-04 16:53:56 UTC (rev 541)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2011-03-08 18:20:09 UTC (rev 542)
@@ -92,4 +92,6 @@
void MHEGStreamPlayer_play(MHEGStreamPlayer *);
void MHEGStreamPlayer_stop(MHEGStreamPlayer *);
+void MHEGStreamPlayer_retuned(void);
+
#endif /* __MHEGSTREAMPLAYER_H__ */
Modified: redbutton-browser/trunk/ResidentProgramClass.c
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.c 2011-03-04 16:53:56 UTC (rev 541)
+++ redbutton-browser/trunk/ResidentProgramClass.c 2011-03-08 18:20:09 UTC (rev 542)
@@ -1012,6 +1012,7 @@
EventData event_tag;
verbose("ResidentProgram: SI_TuneIndex: non-destructive tune");
MHEGEngine_retune(service_url);
+ MHEGStreamPlayer_retuned();
event_tag.choice = EventData_integer;
event_tag.u.integer = EngineEvent_NonDestructiveTuneOK;
MHEGEngine_generateAsyncEvent(¤t_app->rootClass.inst.ref, EventType_engine_event, &event_tag);
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2011-03-04 16:53:56 UTC (rev 541)
+++ redbutton-browser/trunk/StreamClass.c 2011-03-08 18:20:09 UTC (rev 542)
@@ -377,6 +377,8 @@
/* did we get a valid service */
if(service != NULL && service->size > 0)
{
+//TODO: now we do MHEGStreamPlayer_retuned, we probably want to ignore a SetData if it keeps the service ID the same as it currently is
+// new_service_id = -1; do the strncmps; if getServiceID != new_service_id {if(playing) stop; setServiceID; if(playing) play}
/* if playing, stop */
if(t->rootClass.inst.RunningStatus)
MHEGStreamPlayer_stop(t->inst.player);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-03-20 20:01:23
|
Revision: 544
http://redbutton.svn.sourceforge.net/redbutton/?rev=544&view=rev
Author: skilvington
Date: 2011-03-20 20:01:17 +0000 (Sun, 20 Mar 2011)
Log Message:
-----------
try to stop the decoder thread blocking in fread on non-destructive tunes
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/StreamClass.c
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-11 14:08:54 UTC (rev 543)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-20 20:01:17 UTC (rev 544)
@@ -412,7 +412,16 @@
/* signal the threads to stop */
p->stop = true;
- /* wait for them to finish */
+ /*
+ * we want to set the EOF flag on the transport stream,
+ * so if the decoder thread is blocked in fread it will wake up
+ * otherwise the pthread_join call below will never return
+ */
+//TODO: probably need to lock changes to p->ts->ts
+ if(p->ts != NULL)
+ p->ts->ts = freopen("/dev/null", "r", p->ts->ts);
+
+ /* wait for the threads to finish */
pthread_join(p->decode_tid, NULL);
pthread_join(p->video_tid, NULL);
pthread_join(p->audio_tid, NULL);
@@ -421,6 +430,7 @@
LIST_FREE(&p->videoq, VideoFrame, free_VideoFrameListItem);
LIST_FREE(&p->audioq, AudioFrame, free_AudioFrameListItem);
+ /* free the MHEGStream object */
if(p->ts != NULL)
{
MHEGEngine_closeStream(p->ts);
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2011-03-11 14:08:54 UTC (rev 543)
+++ redbutton-browser/trunk/StreamClass.c 2011-03-20 20:01:17 UTC (rev 544)
@@ -417,6 +417,7 @@
//TODO: MHEGEngine_setRecSvcCur(service) - will need to copy 'service' contents
printf("TODO: update rec://svc/cur\n");
//TODO: make sure "rec://svc/cur" and "rec://svc/def" usage is still correct everywhere else
+//TODO: new service should replace original_content
/* ContentPreparation behaviour specified in the ISO MHEG Corrigendum */
MHEGEngine_generateAsyncEvent(&t->rootClass.inst.ref, EventType_content_available, NULL);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-06-02 07:43:29
|
Revision: 546
http://redbutton.svn.sourceforge.net/redbutton/?rev=546&view=rev
Author: skilvington
Date: 2011-06-02 07:43:23 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
no need for external pointers to the MHEGStreamPlayer singleton
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/StreamClass.c
redbutton-browser/trunk/StreamComponent.c
redbutton-browser/trunk/StreamComponent.h
redbutton-browser/trunk/add_instance_vars.conf
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-06-02 07:43:23 UTC (rev 546)
@@ -127,7 +127,7 @@
static MHEGStreamPlayer player;
void
-MHEGStreamPlayer_init(MHEGStreamPlayer **p)
+MHEGStreamPlayer_init(void)
{
static bool created = false;
@@ -168,22 +168,16 @@
verbose("MHEGStreamPlayer: %u users", player.nusers);
- *p = &player;
-
return;
}
void
-MHEGStreamPlayer_fini(MHEGStreamPlayer **p)
+MHEGStreamPlayer_fini(void)
{
- /* assert */
- if(*p != &player)
- fatal("MHEGStreamPlayer: *p=%p, &player=%p", *p, &player);
-
if(player.nusers == 0)
fatal("MHEGStreamPlayer: nusers is 0");
- MHEGStreamPlayer_stop(&player);
+ MHEGStreamPlayer_stop();
player.nusers --;
@@ -200,8 +194,6 @@
verbose("MHEGStreamPlayer: %u users", player.nusers);
- *p = NULL;
-
#if 0
/* this is how you would destroy it */
pthread_mutex_destroy(&player.base_lock);
@@ -221,11 +213,10 @@
*/
void
-MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *p, int id)
+MHEGStreamPlayer_setServiceID(int id)
{
- /* assert */
- if(p != &player)
- fatal("MHEGStreamPlayer_setServiceID: p=%p, &player=%p", p, &player);
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
/* assert */
if(p->playing && p->service_id != id)
@@ -237,11 +228,10 @@
}
void
-MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *p, VideoClass *video)
+MHEGStreamPlayer_setVideoStream(VideoClass *video)
{
- /* assert */
- if(p != &player)
- fatal("MHEGStreamPlayer_setVideoStream: p=%p, &player=%p", p, &player);
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
/* assert */
if(p->playing)
@@ -277,11 +267,10 @@
}
void
-MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *p, AudioClass *audio)
+MHEGStreamPlayer_setAudioStream(AudioClass *audio)
{
- /* assert */
- if(p != &player)
- fatal("MHEGStreamPlayer_setAudioStream: p=%p, &player=%p", p, &player);
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
/* assert */
if(p->playing)
@@ -320,11 +309,10 @@
}
void
-MHEGStreamPlayer_play(MHEGStreamPlayer *p)
+MHEGStreamPlayer_play(void)
{
- /* assert */
- if(p != &player)
- fatal("MHEGStreamPlayer_play: p=%p, &player=%p", p, &player);
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
verbose("MHEGStreamPlayer_play: service_id=%d audio_tag=%d video_tag=%d", p->service_id, p->audio_tag, p->video_tag);
@@ -397,11 +385,10 @@
}
void
-MHEGStreamPlayer_stop(MHEGStreamPlayer *p)
+MHEGStreamPlayer_stop(void)
{
- /* assert */
- if(p != &player)
- fatal("MHEGStreamPlayer_stop: p=%p, &player=%p", p, &player);
+ /* there can be only one */
+ MHEGStreamPlayer *p = &player;
verbose("MHEGStreamPlayer_stop");
@@ -466,8 +453,8 @@
{
verbose("MHEGStreamPlayer: retuned while playing");
/* just stop and restart, when we start playing the A/V PIDs are recalculated */
- MHEGStreamPlayer_stop(p);
- MHEGStreamPlayer_play(p);
+ MHEGStreamPlayer_stop();
+ MHEGStreamPlayer_play();
}
return;
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2011-06-02 07:43:23 UTC (rev 546)
@@ -82,15 +82,15 @@
LIST_OF(AudioFrame) *audioq; /* head of list is next to be played */
} MHEGStreamPlayer;
-void MHEGStreamPlayer_init(MHEGStreamPlayer **);
-void MHEGStreamPlayer_fini(MHEGStreamPlayer **);
+void MHEGStreamPlayer_init(void);
+void MHEGStreamPlayer_fini(void);
-void MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *, int);
-void MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *, VideoClass *);
-void MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *, AudioClass *);
+void MHEGStreamPlayer_setServiceID(int);
+void MHEGStreamPlayer_setVideoStream(VideoClass *);
+void MHEGStreamPlayer_setAudioStream(AudioClass *);
-void MHEGStreamPlayer_play(MHEGStreamPlayer *);
-void MHEGStreamPlayer_stop(MHEGStreamPlayer *);
+void MHEGStreamPlayer_play(void);
+void MHEGStreamPlayer_stop(void);
void MHEGStreamPlayer_retuned(void);
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/StreamClass.c 2011-06-02 07:43:23 UTC (rev 546)
@@ -26,7 +26,7 @@
v->CounterTriggers = NULL;
- MHEGStreamPlayer_init(&v->player);
+ MHEGStreamPlayer_init();
return;
}
@@ -34,7 +34,7 @@
void
free_StreamClassInstanceVars(StreamClassInstanceVars *v)
{
- MHEGStreamPlayer_fini(&v->player);
+ MHEGStreamPlayer_fini();
LIST_FREE(&v->CounterTriggers, CounterTrigger, safe_free);
@@ -110,7 +110,7 @@
*/
if(OctetString_strncmp(service, "dvb:", 4) == 0)
{
- MHEGStreamPlayer_setServiceID(t->inst.player, si_get_service_id(service));
+ MHEGStreamPlayer_setServiceID(si_get_service_id(service));
}
else if(OctetString_strncmp(service, "rec://svc/lcn/", 14) == 0)
{
@@ -120,7 +120,7 @@
else if(OctetString_strcmp(service, "rec://svc/def") == 0)
{
/* use the service ID we are currently tuned to */
- MHEGStreamPlayer_setServiceID(t->inst.player, -1);
+ MHEGStreamPlayer_setServiceID(-1);
}
/* leave player's service ID as it is for "rec://svc/cur" */
else if(OctetString_strcmp(service, "rec://svc/cur") != 0)
@@ -135,10 +135,10 @@
{
if((r = StreamComponent_rootClass(&comp->item)) != NULL
&& r->inst.RunningStatus)
- StreamComponent_play(&comp->item, t->inst.player);
+ StreamComponent_play(&comp->item);
comp = comp->next;
}
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
/* multiplex is now playing */
MHEGEngine_generateAsyncEvent(&t->rootClass.inst.ref, EventType_stream_playing, NULL);
@@ -179,13 +179,13 @@
}
/* stop playing all active StreamComponents */
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
comp = t->multiplex;
while(comp)
{
if((r = StreamComponent_rootClass(&comp->item)) != NULL
&& r->inst.RunningStatus)
- StreamComponent_stop(&comp->item, t->inst.player);
+ StreamComponent_stop(&comp->item);
comp = comp->next;
}
@@ -262,12 +262,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
- MHEGStreamPlayer_setVideoStream(t->inst.player, c);
+ MHEGStreamPlayer_setVideoStream(c);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
return;
}
@@ -284,12 +284,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
- MHEGStreamPlayer_setAudioStream(t->inst.player, c);
+ MHEGStreamPlayer_setAudioStream(c);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
return;
}
@@ -306,12 +306,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
- MHEGStreamPlayer_setVideoStream(t->inst.player, NULL);
+ MHEGStreamPlayer_setVideoStream(NULL);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
return;
}
@@ -328,12 +328,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
- MHEGStreamPlayer_setAudioStream(t->inst.player, NULL);
+ MHEGStreamPlayer_setAudioStream(NULL);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
return;
}
@@ -381,7 +381,7 @@
// new_service_id = -1; do the strncmps; if getServiceID != new_service_id {if(playing) stop; setServiceID; if(playing) play}
/* if playing, stop */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(t->inst.player);
+ MHEGStreamPlayer_stop();
// TODO: the below is very similar to StreamClass_Activation
/*
* update the service ID
@@ -394,7 +394,7 @@
*/
if(OctetString_strncmp(service, "dvb:", 4) == 0)
{
- MHEGStreamPlayer_setServiceID(t->inst.player, si_get_service_id(service));
+ MHEGStreamPlayer_setServiceID(si_get_service_id(service));
}
else if(OctetString_strncmp(service, "rec://svc/lcn/", 14) == 0)
{
@@ -405,7 +405,7 @@
|| OctetString_strcmp(service, "rec://svc/cur") == 0)
{
/* use the service ID we are currently tuned to */
- MHEGStreamPlayer_setServiceID(t->inst.player, -1);
+ MHEGStreamPlayer_setServiceID(-1);
}
else
{
@@ -413,7 +413,7 @@
}
/* if playing, restart, this also update audio/video PIDs */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(t->inst.player);
+ MHEGStreamPlayer_play();
//TODO: MHEGEngine_setRecSvcCur(service) - will need to copy 'service' contents
printf("TODO: update rec://svc/cur\n");
//TODO: make sure "rec://svc/cur" and "rec://svc/def" usage is still correct everywhere else
Modified: redbutton-browser/trunk/StreamComponent.c
===================================================================
--- redbutton-browser/trunk/StreamComponent.c 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/StreamComponent.c 2011-06-02 07:43:23 UTC (rev 546)
@@ -125,16 +125,16 @@
}
void
-StreamComponent_play(StreamComponent *s, MHEGStreamPlayer *player)
+StreamComponent_play(StreamComponent *s)
{
switch(s->choice)
{
case StreamComponent_audio:
- MHEGStreamPlayer_setAudioStream(player, &s->u.audio);
+ MHEGStreamPlayer_setAudioStream(&s->u.audio);
break;
case StreamComponent_video:
- MHEGStreamPlayer_setVideoStream(player, &s->u.video);
+ MHEGStreamPlayer_setVideoStream(&s->u.video);
break;
case StreamComponent_rtgraphics:
@@ -150,16 +150,16 @@
}
void
-StreamComponent_stop(StreamComponent *s, MHEGStreamPlayer *player)
+StreamComponent_stop(StreamComponent *s)
{
switch(s->choice)
{
case StreamComponent_audio:
- MHEGStreamPlayer_setAudioStream(player, NULL);
+ MHEGStreamPlayer_setAudioStream(NULL);
break;
case StreamComponent_video:
- MHEGStreamPlayer_setVideoStream(player, NULL);
+ MHEGStreamPlayer_setVideoStream(NULL);
break;
case StreamComponent_rtgraphics:
Modified: redbutton-browser/trunk/StreamComponent.h
===================================================================
--- redbutton-browser/trunk/StreamComponent.h 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/StreamComponent.h 2011-06-02 07:43:23 UTC (rev 546)
@@ -17,8 +17,8 @@
void StreamComponent_Activation(StreamComponent *);
void StreamComponent_Destruction(StreamComponent *);
-void StreamComponent_play(StreamComponent *, MHEGStreamPlayer *);
-void StreamComponent_stop(StreamComponent *, MHEGStreamPlayer *);
+void StreamComponent_play(StreamComponent *);
+void StreamComponent_stop(StreamComponent *);
#endif /* __STREAMCOMPONENT_H__ */
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2011-03-20 20:34:51 UTC (rev 545)
+++ redbutton-browser/trunk/add_instance_vars.conf 2011-06-02 07:43:23 UTC (rev 546)
@@ -226,8 +226,6 @@
int CounterPosition;
int CounterEndPosition;
LIST_OF(CounterTrigger) *CounterTriggers;
- /* we add this */
- MHEGStreamPlayer *player;
} StreamClassInstanceVars;
</StreamClass>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-06-02 07:54:01
|
Revision: 547
http://redbutton.svn.sourceforge.net/redbutton/?rev=547&view=rev
Author: skilvington
Date: 2011-06-02 07:53:55 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
get rid of horrible hack in non-destructive retunes
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/ResidentProgramClass.c
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-06-02 07:43:23 UTC (rev 546)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-06-02 07:53:55 UTC (rev 547)
@@ -399,23 +399,6 @@
/* signal the threads to stop */
p->stop = true;
- /*
- * we want to set the EOF flag on the transport stream,
- * so if the decoder thread is blocked in fread in mpegts_demux_frame it can escape and check p->stop
- * otherwise the pthread_join call below will never return
- */
- if(p->ts != NULL)
- {
- /* wake up the fread, fread will now start returning 0, but feof() will still return 0 */
- close(fileno(p->ts->ts));
- /*
- * now fread no longer has the stdio lock on the p->ts->ts FILE, do a freopen on it
- * reading /dev/null will set EOF, so feof() will return non-0
- * and the decoder thread will break out of mpegts_demux_frame
- */
- p->ts->ts = freopen("/dev/null", "r", p->ts->ts);
- }
-
/* wait for the threads to finish */
pthread_join(p->decode_tid, NULL);
pthread_join(p->video_tid, NULL);
@@ -438,26 +421,13 @@
}
/*
- * call this after a non-destructive retune
- * if any StreamClass objects are active and playing A/V streams this will update their A/V PIDs to the new service
+ * returns true if currently playing an A/V stream
*/
-void
-MHEGStreamPlayer_retuned(void)
+bool
+MHEGStreamPlayer_isPlaying(void)
{
- /* there can be only one */
- MHEGStreamPlayer *p = &player;
-
- /* are we playing anything */
- if(p->playing)
- {
- verbose("MHEGStreamPlayer: retuned while playing");
- /* just stop and restart, when we start playing the A/V PIDs are recalculated */
- MHEGStreamPlayer_stop();
- MHEGStreamPlayer_play();
- }
-
- return;
+ return player.playing;
}
/*
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2011-06-02 07:43:23 UTC (rev 546)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2011-06-02 07:53:55 UTC (rev 547)
@@ -92,6 +92,6 @@
void MHEGStreamPlayer_play(void);
void MHEGStreamPlayer_stop(void);
-void MHEGStreamPlayer_retuned(void);
+bool MHEGStreamPlayer_isPlaying(void);
#endif /* __MHEGSTREAMPLAYER_H__ */
Modified: redbutton-browser/trunk/ResidentProgramClass.c
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.c 2011-06-02 07:43:23 UTC (rev 546)
+++ redbutton-browser/trunk/ResidentProgramClass.c 2011-06-02 07:53:55 UTC (rev 547)
@@ -1010,9 +1010,23 @@
/* non-destructive tune, ie current app keeps running */
ApplicationClass *current_app = MHEGEngine_getActiveApplication();
EventData event_tag;
+ bool stream_playing = MHEGStreamPlayer_isPlaying();
verbose("ResidentProgram: SI_TuneIndex: non-destructive tune");
+ /*
+ * if a stream is playing, stop it now
+ * otherwise, when we retune the player will block in fread trying to read data from the old service
+ * and we will never be able to stop it
+ */
+ if(stream_playing)
+ MHEGStreamPlayer_stop();
MHEGEngine_retune(service_url);
- MHEGStreamPlayer_retuned();
+ /*
+ * if we were playing, restart
+ * if necessary, this will re-evaluate any A/V PIDs based on the new service ID
+ */
+ if(stream_playing)
+ MHEGStreamPlayer_play();
+ /* let the app know we have successfully retuned */
event_tag.choice = EventData_integer;
event_tag.u.integer = EngineEvent_NonDestructiveTuneOK;
MHEGEngine_generateAsyncEvent(¤t_app->rootClass.inst.ref, EventType_engine_event, &event_tag);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-06-02 08:19:57
|
Revision: 548
http://redbutton.svn.sourceforge.net/redbutton/?rev=548&view=rev
Author: skilvington
Date: 2011-06-02 08:19:51 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
spec says we should not activate unknown programs - doesn't fix Freesat ITV sadly
Modified Paths:
--------------
redbutton-browser/trunk/ResidentProgramClass.c
redbutton-browser/trunk/ResidentProgramClass.h
Modified: redbutton-browser/trunk/ResidentProgramClass.c
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.c 2011-06-02 07:53:55 UTC (rev 547)
+++ redbutton-browser/trunk/ResidentProgramClass.c 2011-06-02 08:19:51 UTC (rev 548)
@@ -24,6 +24,7 @@
#include "si.h"
/* internal functions */
+bool unknown_program(ResidentProgramClass *);
bool run_program(ResidentProgramClass *, LIST_OF(Parameter) *, OctetString *, bool);
bool check_parameters(LIST_OF(Parameter) *, unsigned int, ...);
Parameter *get_parameter(LIST_OF(Parameter) *, unsigned int);
@@ -67,14 +68,18 @@
return;
}
-void
+bool
ResidentProgramClass_Activation(ResidentProgramClass *t)
{
verbose("ResidentProgramClass: %s; Activation", ExternalReference_name(&t->rootClass.inst.ref));
+ /* MHEG spec says if the program is unknown, then disregard this action */
+ if(unknown_program(t))
+ return false;
+
/* has it already been activated */
if(!RootClass_Activation(&t->rootClass))
- return;
+ return true;
/* set RunningStatus */
t->rootClass.inst.RunningStatus = true;
@@ -82,7 +87,7 @@
/* generate IsRunning event */
MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
- return;
+ return true;
}
void
@@ -159,8 +164,11 @@
verbose("ResidentProgramClass: %s; Call '%.*s'", ExternalReference_name(&p->rootClass.inst.ref), p->name.size, p->name.data);
+ /* Activation will fail for unknown programs */
+ if(!ResidentProgramClass_Activation(p))
+ return;
+
/* run it and wait for it to complete */
- ResidentProgramClass_Activation(p);
rc = run_program(p, params->parameters, caller_gid, false);
/* store the return value */
@@ -199,11 +207,14 @@
verbose("ResidentProgramClass: %s; Fork '%.*s'", ExternalReference_name(&p->rootClass.inst.ref), p->name.size, p->name.data);
+ /* Activation will fail for unknown programs */
+ if(!ResidentProgramClass_Activation(p))
+ return;
+
/* run it in the background */
/******************************************************************************************/
/* TODO */
printf("TODO: ResidentProgramClass_Fork not yet implemented - running in foreground\n");
- ResidentProgramClass_Activation(p);
rc = run_program(p, params->parameters, caller_gid, true);
/* return immediately */
/******************************************************************************************/
@@ -234,11 +245,7 @@
}
/*
- * run the given program (identified by the name field in the ResidentProgramClass)
- * returns true if the program succeeds
- * sets the parameters to the values described by the UK MHEG Profile
- * caller_gid is used to resolve Generic variables in the parameters
- * if forked is true, return immediately and run the program in the background
+ * programs defined in the UK MHEG Profile
*/
struct
@@ -275,7 +282,37 @@
{ "", "", NULL }
};
+/*
+ * returns true if the program is not found in our list
+ */
+
bool
+unknown_program(ResidentProgramClass *p)
+{
+ unsigned int i;
+
+ for(i=0; resident_progs[i].func!=NULL; i++)
+ {
+ if(OctetString_strcmp(&p->name, resident_progs[i].short_name) == 0
+ || OctetString_strcmp(&p->name, resident_progs[i].long_name) == 0)
+ return false;
+ }
+
+ /* not found */
+ error("Unknown ResidentProgram: '%.*s'", p->name.size, p->name.data);
+
+ return true;
+}
+
+/*
+ * run the given program (identified by the name field in the ResidentProgramClass)
+ * returns true if the program succeeds
+ * sets the parameters to the values described by the UK MHEG Profile
+ * caller_gid is used to resolve Generic variables in the parameters
+ * if forked is true, return immediately and run the program in the background
+ */
+
+bool
run_program(ResidentProgramClass *p, LIST_OF(Parameter) *params, OctetString *caller_gid, bool forked)
{
bool rc;
Modified: redbutton-browser/trunk/ResidentProgramClass.h
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.h 2011-06-02 07:53:55 UTC (rev 547)
+++ redbutton-browser/trunk/ResidentProgramClass.h 2011-06-02 08:19:51 UTC (rev 548)
@@ -8,7 +8,7 @@
#include "ISO13522-MHEG-5.h"
void ResidentProgramClass_Preparation(ResidentProgramClass *);
-void ResidentProgramClass_Activation(ResidentProgramClass *);
+bool ResidentProgramClass_Activation(ResidentProgramClass *);
void ResidentProgramClass_Deactivation(ResidentProgramClass *);
void ResidentProgramClass_Destruction(ResidentProgramClass *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2011-09-14 17:52:13
|
Revision: 549
http://redbutton.svn.sourceforge.net/redbutton/?rev=549&view=rev
Author: skilvington
Date: 2011-09-14 17:52:07 +0000 (Wed, 14 Sep 2011)
Log Message:
-----------
make our own copies of some deprecated ffmpeg functions
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/utils.c
redbutton-browser/trunk/utils.h
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2011-06-02 08:19:51 UTC (rev 548)
+++ redbutton-browser/trunk/MHEGDisplay.c 2011-09-14 17:52:07 UTC (rev 549)
@@ -895,14 +895,14 @@
size = mpeg->size;
do
{
- used = avcodec_decode_video(codec_ctx, yuv_frame, &got_picture, data, size);
+ used = my_avcodec_decode_video(codec_ctx, yuv_frame, &got_picture, data, size);
data += used;
size -= used;
}
while(!got_picture && size > 0);
/* need to call it one final time with size=0, to actually get the frame */
if(!got_picture)
- (void) avcodec_decode_video(codec_ctx, yuv_frame, &got_picture, data, size);
+ (void) my_avcodec_decode_video(codec_ctx, yuv_frame, &got_picture, data, size);
if(!got_picture)
{
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-06-02 08:19:51 UTC (rev 548)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-09-14 17:52:07 UTC (rev 549)
@@ -512,7 +512,7 @@
{
audio_frame = new_AudioFrameListItem();
af = &audio_frame->item;
- used = avcodec_decode_audio2(audio_codec_ctx, (int16_t *) af->data, (int *) &af->size, data, size);
+ used = my_avcodec_decode_audio2(audio_codec_ctx, (int16_t *) af->data, (int *) &af->size, data, size);
data += used;
size -= used;
if(used > 0 && af->size > 0)
@@ -541,7 +541,7 @@
}
else if(p->have_video && pkt.stream_index == p->video_pid && pkt.dts != AV_NOPTS_VALUE)
{
- (void) avcodec_decode_video(video_codec_ctx, frame, &got_picture, pkt.data, pkt.size);
+ (void) my_avcodec_decode_video(video_codec_ctx, frame, &got_picture, pkt.data, pkt.size);
if(got_picture)
{
pts = pkt.dts / video_time_base;
Modified: redbutton-browser/trunk/utils.c
===================================================================
--- redbutton-browser/trunk/utils.c 2011-06-02 08:19:51 UTC (rev 548)
+++ redbutton-browser/trunk/utils.c 2011-09-14 17:52:07 UTC (rev 549)
@@ -69,6 +69,32 @@
return fmt;
}
+/* deprecated FFMPEG functions that have now been removed */
+int
+my_avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, const uint8_t *buf, int buf_size)
+{
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = (uint8_t *) buf;
+ avpkt.size = buf_size;
+
+ return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt);
+}
+
+int
+my_avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const uint8_t *buf, int buf_size)
+{
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = (uint8_t *) buf;
+ avpkt.size = buf_size;
+ // HACK for CorePNG to decode as normal PNG by default
+ avpkt.flags = AV_PKT_FLAG_KEY;
+
+ return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt);
+}
+
+
/*
* returns 15 for 'f' etc
*/
Modified: redbutton-browser/trunk/utils.h
===================================================================
--- redbutton-browser/trunk/utils.h 2011-06-02 08:19:51 UTC (rev 548)
+++ redbutton-browser/trunk/utils.h 2011-09-14 17:52:07 UTC (rev 549)
@@ -41,6 +41,10 @@
enum PixelFormat find_av_pix_fmt(int, unsigned long, unsigned long, unsigned long);
+/* deprecated FFMPEG functions that have now been removed */
+int my_avcodec_decode_audio2(AVCodecContext *, int16_t *, int *, const uint8_t *, int);
+int my_avcodec_decode_video(AVCodecContext *, AVFrame *, int *, const uint8_t *, int);
+
unsigned int char2hex(unsigned char);
int next_utf8(unsigned char *, int, int *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|