mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 04:40:30 +00:00
send fps in packets. changed reconfigure api to include also fps. compile fixes.
This commit is contained in:
@@ -64,6 +64,7 @@ void decode_frame(struct coded_data *cdata, struct video_frame *frame)
|
||||
payload_hdr_t *hdr;
|
||||
uint32_t data_pos;
|
||||
int prints=0;
|
||||
double fps;
|
||||
|
||||
while (cdata != NULL) {
|
||||
pckt = cdata->data;
|
||||
@@ -73,15 +74,17 @@ void decode_frame(struct coded_data *cdata, struct video_frame *frame)
|
||||
color_spec = hdr->colorspc;
|
||||
len = ntohs(hdr->length);
|
||||
data_pos = ntohl(hdr->offset);
|
||||
fps = ntohl(hdr->fps)/65536.0;
|
||||
|
||||
/* Critical section
|
||||
* each thread *MUST* wait here if this condition is true
|
||||
*/
|
||||
if (!(frame->width == width &&
|
||||
frame->height == height &&
|
||||
frame->color_spec == color_spec)) {
|
||||
frame->color_spec == color_spec &&
|
||||
frame->fps == fps)) {
|
||||
frame->reconfigure(frame->state, width, height,
|
||||
color_spec);
|
||||
color_spec, fps);
|
||||
frame->src_linesize =
|
||||
vc_getsrc_linesize(width, color_spec);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef struct {
|
||||
uint16_t length; /* octets */
|
||||
uint8_t colorspc;
|
||||
uint8_t flags;
|
||||
uint32_t fps; /* fixed point fps. take care! */
|
||||
} payload_hdr_t;
|
||||
|
||||
/* FIXME: this is only needed because fdisplay() takes "struct display" as a parameter */
|
||||
|
||||
@@ -127,6 +127,7 @@ tx_send(struct video_tx *tx, struct video_frame *frame, struct rtp *rtp_session)
|
||||
payload_hdr.width = htons(frame->width);
|
||||
payload_hdr.height = htons(frame->height);
|
||||
payload_hdr.colorspc = frame->color_spec;
|
||||
payload_hdr.fps = htonl((int)(frame->fps * 65536));
|
||||
|
||||
do {
|
||||
payload_hdr.offset = htonl(pos);
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef enum {
|
||||
} codec_t;
|
||||
|
||||
typedef void (*decoder_t)(unsigned char *dst, unsigned char *src, int dst_len, int rshift, int gshift, int bshift);
|
||||
typedef void (*reconfigure_t)(void *state, int width, int height, codec_t color_spec);
|
||||
typedef void (*reconfigure_t)(void *state, int width, int height, codec_t color_spec, double fps);
|
||||
|
||||
|
||||
struct video_frame {
|
||||
@@ -83,6 +83,7 @@ struct video_frame {
|
||||
decoder_t decoder;
|
||||
reconfigure_t reconfigure;
|
||||
void *state;
|
||||
double fps;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -70,15 +70,6 @@
|
||||
|
||||
#define HDSP_MAGIC 0x12345678
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int mode;
|
||||
double fps;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
char interlaced;
|
||||
} hdsp_mode_table_t;
|
||||
|
||||
const hdsp_mode_table_t hdsp_mode_table[] = {
|
||||
{"SMPTE274", SV_MODE_SMPTE274_25P, 25, 1920, 1080, 0},
|
||||
{"SMPTE274", SV_MODE_SMPTE274_29I, 29, 1920, 1080, 1},
|
||||
@@ -105,7 +96,6 @@ volatile int worker_waiting;
|
||||
struct video_frame frame;
|
||||
const hdsp_mode_table_t *mode;
|
||||
unsigned interlaced:1;
|
||||
double fps;
|
||||
};
|
||||
|
||||
static void *display_thread_hd(void *arg)
|
||||
@@ -197,7 +187,7 @@ int display_hdstation_putf(void *state, char *frame)
|
||||
|
||||
static void
|
||||
reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
codec_t color_spec)
|
||||
codec_t color_spec, double fps)
|
||||
{
|
||||
struct state_hdsp *s = (struct state_hdsp *)state;
|
||||
int i, res;
|
||||
@@ -210,7 +200,7 @@ reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
if(hdsp_mode_table[i].width == width &&
|
||||
hdsp_mode_table[i].height == height &&
|
||||
s->interlaced == hdsp_mode_table[i].interlaced &&
|
||||
s->fps == hdsp_mode_table[i].fps) {
|
||||
fps == hdsp_mode_table[i].fps) {
|
||||
s->mode = &hdsp_mode_table[i];
|
||||
break;
|
||||
}
|
||||
@@ -219,7 +209,7 @@ reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
if(s->mode == NULL) {
|
||||
fprintf(stderr, "Reconfigure failed. Expect troubles pretty soon..\n"
|
||||
"\tRequested: %dx%d, color space %d, fps %f, interlaced: %d\n",
|
||||
width, height, color_spec, s->fps, s->interlaced);
|
||||
width, height, color_spec, fps, s->interlaced);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -227,6 +217,7 @@ reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
s->frame.width = width;
|
||||
s->frame.height = height;
|
||||
s->frame.dst_bpp = get_bpp(color_spec);
|
||||
s->frame.fps = fps;
|
||||
|
||||
s->hd_video_mode = SV_MODE_COLOR_YUV422 | SV_MODE_ACTIVE_STREAMER;
|
||||
|
||||
@@ -290,7 +281,7 @@ void *display_hdstation_init(char *fmt)
|
||||
if (fmt != NULL) {
|
||||
if (strcmp(fmt, "help") == 0) {
|
||||
printf("hdstation options:\n");
|
||||
printf("\tfps:[mode:[codec:[i|p]]]\n");
|
||||
printf("\t[fps:[mode:[codec:[i|p]]]]\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -359,7 +350,7 @@ void *display_hdstation_init(char *fmt)
|
||||
}
|
||||
|
||||
if(s->mode) {
|
||||
reconfigure_screen(s, s->mode->width, s->mode->height, s->frame.color_spec);
|
||||
reconfigure_screen(s, s->mode->width, s->mode->height, s->frame.color_spec, s->mode->fps);
|
||||
}
|
||||
|
||||
pthread_mutex_init(&s->lock, NULL);
|
||||
@@ -377,7 +368,7 @@ void *display_hdstation_init(char *fmt)
|
||||
}
|
||||
s->frame.state = s;
|
||||
s->frame.reconfigure = (reconfigure_t)reconfigure_screen;
|
||||
s->frame.decoder = (decoder_t)memcpy;
|
||||
s->frame.decoder = (decoder_t)memcpy;
|
||||
|
||||
return (void *)s;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
* $Date: 2010/01/28 18:17:28 $
|
||||
*
|
||||
*/
|
||||
#include <video_display.h>
|
||||
|
||||
#define DISPLAY_HDSTATION_ID 0x74ac3e0f
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ struct state_sdl {
|
||||
void show_help(void);
|
||||
void cleanup_screen(struct state_sdl *s);
|
||||
void reconfigure_screen(void *s, unsigned int width, unsigned int height,
|
||||
codec_t codec);
|
||||
codec_t codec, double fps);
|
||||
|
||||
extern int should_exit;
|
||||
|
||||
@@ -211,7 +211,7 @@ void cleanup_screen(struct state_sdl *s)
|
||||
|
||||
void
|
||||
reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
codec_t color_spec)
|
||||
codec_t color_spec, double fps)
|
||||
{
|
||||
struct state_sdl *s = (struct state_sdl *)state;
|
||||
int itemp;
|
||||
@@ -229,6 +229,7 @@ reconfigure_screen(void *state, unsigned int width, unsigned int height,
|
||||
|
||||
s->frame.width = width;
|
||||
s->frame.height = height;
|
||||
s->frame.fps = fps;
|
||||
|
||||
ret =
|
||||
XGetGeometry(s->display, DefaultRootWindow(s->display), &wtemp,
|
||||
@@ -463,7 +464,7 @@ void *display_sdl_init(char *fmt)
|
||||
}
|
||||
|
||||
if (fmt != NULL) {
|
||||
reconfigure_screen(s, s->frame.width, s->frame.height, s->codec_info->codec);
|
||||
reconfigure_screen(s, s->frame.width, s->frame.height, s->codec_info->codec, s->frame.fps);
|
||||
temp = SDL_LoadBMP("/usr/share/uv-0.3.1/uv_startup.bmp");
|
||||
if (temp == NULL) {
|
||||
temp =
|
||||
|
||||
Reference in New Issue
Block a user