Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef enum _ItdbVideoFormat ItdbVideoFormat;
- enum _ItdbVideoFormat {
- VIDEO_FORMAT_MPEG4,
- VIDEO_FORMAT_H263,
- VIDEO_FORMAT_H264
- };
- typedef struct _Itdb_VideoFormat Itdb_VideoFormat;
- struct _Itdb_VideoFormat {
- ItdbVideoFormat format;
- gchar *profile;
- gint level;
- gboolean supports_b_frames;
- };
- static Itdb_VideoFormat *g_value_to_video_format (GHashTable *dict)
- {
- Itdb_VideoFormat *video_spec;
- g_return_val_if_fail (dict != NULL, NULL);
- video_spec = g_new0 (Itdb_VideoFormat, 1);
- if (video_spec == NULL) {
- return NULL;
- }
- dict_to_struct (dict, sysinfo_video_format_fields_mapping, video_spec);
- return video_spec;
- }
- static GList *parse_video_format_list (GHashTable *sysinfo_dict,
- const char *key)
- {
- GValue *to_parse;
- GList *formats = NULL;
- GHashTableIter codec_iter;
- gpointer codec_key, codec_value;
- to_parse = g_hash_table_lookup (sysinfo_dict, key);
- if (to_parse == NULL) {
- return NULL;
- }
- if (!G_VALUE_HOLDS (to_parse, G_TYPE_HASH_TABLE)) {
- return NULL;
- }
- g_hash_table_iter_init (&codec_iter, g_value_get_boxed (to_parse));
- while (g_hash_table_iter_next (&codec_iter, &codec_key, &codec_value)) {
- GHashTable *codec_dict;
- GValue *mul_profiles;
- Itdb_VideoFormat *format;
- g_return_val_if_fail (G_VALUE_HOLDS (codec_value, G_TYPE_HASH_TABLE), NULL);
- codec_dict = g_value_get_boxed (codec_value);
- g_return_val_if_fail (codec_dict != NULL, NULL);
- format = g_value_to_video_format (codec_dict);
- if (format != NULL) {
- mul_profiles = g_hash_table_lookup (codec_dict, "Profiles");
- if (mul_profiles != NULL
- && G_VALUE_HOLDS (mul_profiles, G_TYPE_HASH_TABLE)) {
- GHashTable *profile_dict;
- Itdb_VideoFormat *new_format;
- GHashTableIter profile_iter;
- gpointer profile_key, profile_value;
- g_hash_table_iter_init (&profile_iter, g_value_get_boxed (mul_profiles));
- while (g_hash_table_iter_next (&profile_iter, &profile_key, &profile_value)) {
- new_format = format;
- new_format->profile = malloc(sizeof(format->profile));
- new_format->profile = g_strdup (format->profile);
- formats = g_list_prepend (formats, new_format);
- }
- } else {
- formats = g_list_prepend (formats, format);
- }
- }
- }
- g_hash_table_remove (sysinfo_dict, key);
- return formats;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement