Example #1
0
static htsmsg_t *
tvh_codec_audio_get_list_sample_fmts(TVHAudioCodec *self)
{
    htsmsg_t *list = NULL, *map = NULL;
    const enum AVSampleFormat *sample_fmts = self->sample_fmts;
    enum AVSampleFormat f = AV_SAMPLE_FMT_NONE;
    const char *f_str = NULL;
    int i;

    if (sample_fmts && (list = htsmsg_create_list())) {
        if (!(map = htsmsg_create_map())) {
            htsmsg_destroy(list);
            list = NULL;
        }
        else {
            ADD_ENTRY(list, map, s32, f, str, AUTO_STR);
            for (i = 0; (f = sample_fmts[i]) != AV_SAMPLE_FMT_NONE; i++) {
                if (!(f_str = av_get_sample_fmt_name(f)) ||
                    !(map = htsmsg_create_map())) {
                    htsmsg_destroy(list);
                    list = NULL;
                    break;
                }
                ADD_ENTRY(list, map, s32, f, str, f_str);
            }
        }
    }
    return list;
}
Example #2
0
static htsmsg_t *
tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self)
{
    htsmsg_t *list = NULL, *map = NULL;
    const uint64_t *channel_layouts = self->channel_layouts;
    uint64_t l = 0;
    char l_buf[16];
    int i;

    if (channel_layouts && (list = htsmsg_create_list())) {
        if (!(map = htsmsg_create_map())) {
            htsmsg_destroy(list);
            list = NULL;
        }
        else {
            ADD_ENTRY(list, map, s64, l, str, AUTO_STR);
            for (i = 0; (l = channel_layouts[i]); i++) {
                if (l < INT64_MAX) {
                    if (!(map = htsmsg_create_map())) {
                        htsmsg_destroy(list);
                        list = NULL;
                        break;
                    }
                    l_buf[0] = '\0';
                    av_get_channel_layout_string(l_buf, sizeof(l_buf), 0, l);
                    ADD_ENTRY(list, map, s64, l, str, l_buf);
                }
            }
        }
    }
    return list;
}
Example #3
0
int add_sort_list(char *path, int priority, int source, char *source_path[])
{
	int i, n;
	char filename[4096];
	struct stat buf;

	TRACE("add_sort_list: filename %s, priority %d\n", path, priority);
	if(strlen(path) > 1 && strcmp(path + strlen(path) - 2, "/*") == 0)
		path[strlen(path) - 2] = '\0';

	TRACE("add_sort_list: filename %s, priority %d\n", path, priority);
re_read:
	if(path[0] == '/' || strncmp(path, "./", 2) == 0 || strncmp(path, "../", 3) == 0 || mkisofs_style == 1) {
		if(lstat(path, &buf) == -1)
			goto error;
		TRACE("adding filename %s, priority %d, st_dev %llx, st_ino %llx\n", path, priority, buf.st_dev, buf.st_ino);
		ADD_ENTRY(buf, priority);
		return TRUE;
	}

	for(i = 0, n = 0; i < source; i++) {
		strcat(strcat(strcpy(filename, source_path[i]), "/"), path);
		if(lstat(filename, &buf) == -1) {
			if(!(errno == ENOENT || errno == ENOTDIR))
				goto error;
			continue;
		}
		ADD_ENTRY(buf, priority);
		n ++;
	}

	if(n == 0 && mkisofs_style == -1 && lstat(path, &buf) != -1) {
		ERROR("WARNING: Mkisofs style sortlist detected! This is supported but please\n");
		ERROR("convert to mksquashfs style sortlist! A sortlist entry ");
	        ERROR("should be\neither absolute (starting with ");
		ERROR("'/') start with './' or '../' (taken to be\nrelative to $PWD), otherwise it ");
		ERROR("is assumed the entry is relative to one\nof the source directories, i.e. with ");
		ERROR("\"mksquashfs test test.sqsh\",\nthe sortlist ");
		ERROR("entry \"file\" is assumed to be inside the directory test.\n\n");
		mkisofs_style = 1;
		goto re_read;
	}

	mkisofs_style = 0;

	if(n == 1)
		return TRUE;
	if(n > 1)
		BAD_ERROR(" Ambiguous sortlist entry \"%s\"\n\nIt maps to more than one source entry!  Please use an absolute path.\n", path);

error:
        fprintf(stderr, "Cannot stat sortlist entry \"%s\"\n", path);
        fprintf(stderr, "This is probably because you're using the wrong file\n");
        fprintf(stderr, "path relative to the source directories\n");
        return FALSE;
}
Example #4
0
static htsmsg_t *
tvh_codec_audio_get_list_sample_rates(TVHAudioCodec *self)
{
    htsmsg_t *list = NULL, *map = NULL;
    const int *sample_rates = self->sample_rates;
    int r = 0, i;

   if (sample_rates && (list = htsmsg_create_list())) {
        if (!(map = htsmsg_create_map())) {
            htsmsg_destroy(list);
            list = NULL;
        }
        else {
            ADD_ENTRY(list, map, s32, r, str, AUTO_STR);
            for (i = 0; (r = sample_rates[i]); i++) {
                if (!(map = htsmsg_create_map())) {
                    htsmsg_destroy(list);
                    list = NULL;
                    break;
                }
                ADD_S32_VAL(list, map, r);
            }
        }
    }
    return list;
}
Example #5
0
int add_sort_list(char *path, int priority, int source, char *source_path[])
{
	int i, n;
	struct stat buf;

	TRACE("add_sort_list: filename %s, priority %d\n", path, priority);
	if(strlen(path) > 1 && strcmp(path + strlen(path) - 2, "/*") == 0)
		path[strlen(path) - 2] = '\0';

	TRACE("add_sort_list: filename %s, priority %d\n", path, priority);
re_read:
	if(path[0] == '/' || strncmp(path, "./", 2) == 0 ||
			strncmp(path, "../", 3) == 0 || mkisofs_style == 1) {
		if(lstat(path, &buf) == -1)
			goto error;
		TRACE("adding filename %s, priority %d, st_dev %d, st_ino "
			"%lld\n", path, priority, (int) buf.st_dev,
			(long long) buf.st_ino);
		ADD_ENTRY(buf, priority);
		return TRUE;
	}

	for(i = 0, n = 0; i < source; i++) {
		char *filename;
		int res = asprintf(&filename, "%s/%s", source_path[i], path);
		if(res == -1)
			BAD_ERROR("asprintf failed in add_sort_list\n");
		res = lstat(filename, &buf);
		free(filename);
		if(res == -1) {
			if(!(errno == ENOENT || errno == ENOTDIR))
				goto error;
			continue;
		}
		ADD_ENTRY(buf, priority);
		n ++;
	}

	if(n == 0 && mkisofs_style == -1 && lstat(path, &buf) != -1) {
		ERROR("WARNING: Mkisofs style sortlist detected! This is "
			"supported but please\n");
		ERROR("convert to mksquashfs style sortlist! A sortlist entry");
	        ERROR(" should be\neither absolute (starting with ");
		ERROR("'/') start with './' or '../' (taken to be\nrelative to "
			"$PWD), otherwise it ");
		ERROR("is assumed the entry is relative to one\nof the source "
			"directories, i.e. with ");
		ERROR("\"mksquashfs test test.sqsh\",\nthe sortlist ");
		ERROR("entry \"file\" is assumed to be inside the directory "
			"test.\n\n");
		mkisofs_style = 1;
		goto re_read;
	}

	mkisofs_style = 0;

	if(n == 1)
		return TRUE;
	if(n > 1) {
		ERROR(" Ambiguous sortlist entry \"%s\"\n\nIt maps to more "
			"than one source entry!  Please use an absolute path."
			"\n", path);
		return FALSE;
	}

error:
        ERROR_START("Cannot stat sortlist entry \"%s\"\n", path);
        ERROR("This is probably because you're using the wrong file\n");
        ERROR("path relative to the source directories.");
	ERROR_EXIT("  Ignoring");
	/*
	 * Historical note
	 * Failure to stat a sortlist entry is deliberately ignored, even
	 * though it is an error.  Squashfs release 2.2 changed the behaviour
	 * to treat it as a fatal error, but it was changed back to
	 * the original behaviour to ignore it in release 2.2-r2 following
	 * feedback from users at the time.
	 */
        return TRUE;
}
Example #6
0
typedef struct
{
  const gchar *name;
  gint val;
  const gchar *droid;
} Entry;

struct Node
{
  const gchar *droid;
  const gchar *gst;
  Entry entries[19];
} Nodes[] = {
  /* *INDENT-OFF* */
  {"flash-mode-values", "flash-mode", {
      ADD_ENTRY (GST_PHOTOGRAPHY_FLASH_MODE_AUTO, "auto"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FLASH_MODE_OFF, "off"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FLASH_MODE_ON, "on"),
      {NULL, -1}
    }},
  {"focus-mode-values", "focus-mode", {
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_AUTO, "auto"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_MACRO, "macro"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT, NULL),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY, "infinity"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL, "fixed"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED, "edof"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL, "continuous"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED, "continuous"),
      ADD_ENTRY (GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL, NULL),
      {NULL, -1}
Example #7
0
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int braille_to_char[64]= {0};
char * lines[3];
int length[3];

#define ADD_ENTRY(LOC,VAL)  braille_to_char[LOC] = VAL;
#define GET_VAL(VAL) braille_to_char[VAL]
							
void fill_braille_array()
{
	ADD_ENTRY(1,'A')
	ADD_ENTRY(5,'B')
	ADD_ENTRY(3,'C')
	ADD_ENTRY(11,'D')
	ADD_ENTRY(9,'E')
	ADD_ENTRY(7,'F')
	ADD_ENTRY(15,'G')
	ADD_ENTRY(13,'H')
	ADD_ENTRY(6,'I')
	ADD_ENTRY(14,'J')
	ADD_ENTRY(7,'K')
	ADD_ENTRY(21,'L')
	ADD_ENTRY(19,'M')
	ADD_ENTRY(27,'N')
	ADD_ENTRY(25,'O')
	ADD_ENTRY(23,'P')
	ADD_ENTRY(31,'Q')
	ADD_ENTRY(29,'R')