diff --git a/ultragrid/Makefile.in b/ultragrid/Makefile.in index dfe9fbb48..647a8697a 100644 --- a/ultragrid/Makefile.in +++ b/ultragrid/Makefile.in @@ -78,6 +78,7 @@ OBJS = @OBJS@ \ src/video_capture/null.o \ src/video_capture/aggregate.o \ src/video_compress.o \ + src/video_compress/none.o \ src/video_decompress.o \ src/video_decompress/null.o \ src/video_display.o \ diff --git a/ultragrid/src/main.c b/ultragrid/src/main.c index fe048410c..2f00d3dc1 100644 --- a/ultragrid/src/main.c +++ b/ultragrid/src/main.c @@ -104,8 +104,7 @@ struct state_uv { uint32_t ts; struct tx *tx; struct display *display_device; - char *compress_options; - int requested_compression; + char *requested_compression; const char *requested_display; const char *requested_capture; unsigned requested_mtu; @@ -528,9 +527,8 @@ static void *sender_thread(void *arg) int tile_y_count; struct compress_state *compression; - compression = compress_init(uv->compress_options); - if(uv->requested_compression - && compression == NULL) { + compression = compress_init(uv->requested_compression); + if(compression == NULL) { fprintf(stderr, "Error initializing compression.\n"); exit_uv(0); } @@ -551,9 +549,7 @@ static void *sender_thread(void *arg) audio_sdi_send(uv->audio, audio); } //TODO: Unghetto this - if (uv->requested_compression) { - tx_frame = compress_frame(compression, tx_frame); - } + tx_frame = compress_frame(compression, tx_frame); if(!tx_frame) continue; if(uv->connections_count == 1) { /* normal case - only one connection */ @@ -636,8 +632,7 @@ int main(int argc, char *argv[]) uv->display_device = NULL; uv->requested_display = "none"; uv->requested_capture = "none"; - uv->requested_compression = FALSE; - uv->compress_options = NULL; + uv->requested_compression = "none"; uv->decoder_mode = NULL; uv->postprocess = NULL; uv->requested_mtu = 0; @@ -685,8 +680,7 @@ int main(int argc, char *argv[]) printf("%s\n", PACKAGE_STRING); return EXIT_SUCCESS; case 'c': - uv->requested_compression = TRUE; - uv->compress_options = optarg; + uv->requested_compression = optarg; break; case 'i': uv->use_ihdtv_protocol = 1; @@ -746,13 +740,7 @@ int main(int argc, char *argv[]) printf("Display device: %s\n", uv->requested_display); printf("Capture device: %s\n", uv->requested_capture); printf("MTU : %d\n", uv->requested_mtu); - /*printf("Compression : "); - if (uv->requested_compression) { - printf("%s", get_compress_name(uv->compression)); - } else { - printf("none"); - } - printf("\n");*/ + printf("Compression : %s\n", uv->requested_compression); if (uv->use_ihdtv_protocol) printf("Network protocol: ihdtv\n"); @@ -907,8 +895,8 @@ int main(int argc, char *argv[]) goto cleanup; } /* following block only shows help (otherwise initialized in sender thread */ - if(uv->requested_compression && strstr(uv->compress_options,"help") != NULL) { - struct compress_state *compression = compress_init(uv->compress_options); + if(strstr(uv->requested_compression,"help") != NULL) { + struct compress_state *compression = compress_init(uv->requested_compression); compress_done(compression); exit_status = EXIT_SUCCESS; goto cleanup; @@ -947,7 +935,7 @@ int main(int argc, char *argv[]) if (strcmp("none", uv->requested_display) != 0) pthread_join(receiver_thread_id, NULL); - if (strcmp("none", uv->requested_capture) != 0 || uv->requested_compression) + if (strcmp("none", uv->requested_capture) != 0) pthread_join(sender_thread_id, NULL); /* also wait for audio threads */ diff --git a/ultragrid/src/video_compress.c b/ultragrid/src/video_compress.c index 7d91c7e5a..60f9e3a73 100644 --- a/ultragrid/src/video_compress.c +++ b/ultragrid/src/video_compress.c @@ -57,6 +57,7 @@ #include "video_compress/dxt_glsl.h" #include "video_compress/fastdxt.h" #include "video_compress/jpeg.h" +#include "video_compress/none.h" #include "lib_common.h" /* *_str are symbol names inside library */ @@ -92,6 +93,7 @@ struct compress_t compress_modules[] = { #if defined HAVE_JPEG || defined BUILD_LIBRARIES {"JPEG", "jpeg", MK_NAME(jpeg_compress_init), MK_NAME(jpeg_compress), MK_NAME(jpeg_compress_done), NULL}, #endif + {"none", NULL, MK_STATIC(none_compress_init), MK_STATIC(none_compress), MK_STATIC(none_compress_done), NULL}, }; #define MAX_COMPRESS_MODULES (sizeof(compress_modules)/sizeof(struct compress_t)) diff --git a/ultragrid/src/video_compress/none.c b/ultragrid/src/video_compress/none.c new file mode 100644 index 000000000..e1e4b8001 --- /dev/null +++ b/ultragrid/src/video_compress/none.c @@ -0,0 +1,91 @@ +/* + * FILE: dxt_glsl_compress.c + * AUTHORS: Martin Benes + * Lukas Hejtmanek + * Petr Holub + * Milos Liska + * Jiri Matela + * Dalibor Matura <255899@mail.muni.cz> + * Ian Wesley-Smith + * + * Copyright (c) 2005-2011 CESNET z.s.p.o. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * + * This product includes software developed by CESNET z.s.p.o. + * + * 4. Neither the name of the CESNET nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#include "config_unix.h" +#endif /* HAVE_CONFIG_H */ +#include "debug.h" +#include "host.h" +#include "video_codec.h" + +#include + +#define MAGIC 0x45bb3321 + + +struct none_video_compress { + uint32_t magic; +}; + +void * none_compress_init(char * opts) +{ + struct none_video_compress *s; + + s = (struct none_video_compress *) malloc(sizeof(struct none_video_compress)); + s->magic = MAGIC; + + return s; +} + +struct video_frame * none_compress(void *arg, struct video_frame * tx) +{ + struct none_video_compress *s = (struct none_video_compress *) arg; + + assert(s->magic == MAGIC); + + return tx; +} + +void none_compress_done(void *arg) +{ + struct none_video_compress *s = (struct none_video_compress *) arg; + + assert(s->magic == MAGIC); + + free(arg); +} diff --git a/ultragrid/src/video_compress/none.h b/ultragrid/src/video_compress/none.h new file mode 100644 index 000000000..439327f58 --- /dev/null +++ b/ultragrid/src/video_compress/none.h @@ -0,0 +1,54 @@ +/* + * FILE: dxt_glsl_compress.h + * AUTHORS: Martin Benes + * Lukas Hejtmanek + * Petr Holub + * Milos Liska + * Jiri Matela + * Dalibor Matura <255899@mail.muni.cz> + * Ian Wesley-Smith + * + * Copyright (c) 2005-2010 CESNET z.s.p.o. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * + * This product includes software developed by CESNET z.s.p.o. + * + * 4. Neither the name of the CESNET nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "video_codec.h" + +struct gl_context; + +void * none_compress_init(char * opts); +struct video_frame * none_compress(void *args, struct video_frame * tx); +void none_compress_done(void *args);