Changeset 30698 for titan/titan/player.h
- Timestamp:
- 10/25/14 13:12:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/player.h
r30678 r30698 810 810 // status.prefillbuffer = 1; 811 811 812 //analyze_streams(data); 813 812 814 int count = 0; 813 815 m_gst_startpts = 0; … … 838 840 { 839 841 #ifdef EPLAYER4 842 // GstBus *bus; 843 // GstStateChangeReturn ret; 844 // gint flags; 840 845 gst_init(&argc, &argv); 841 846 #endif … … 845 850 int gstbuscall(GstBus *bus, GstMessage *msg, CustomData *data) 846 851 { 847 848 852 int ret = 1; 849 853 if(!pipeline) return 0; … … 863 867 break; 864 868 case GST_MESSAGE_STATE_CHANGED: 869 debug(150, "gst message state changed"); 865 870 if(GST_MESSAGE_SRC(msg) != GST_OBJECT(pipeline)) 866 break; 867 868 GstState old_state, new_state; 869 gst_message_parse_state_changed(msg, &old_state, &new_state, NULL); 870 871 break; 872 873 GstState old_state, new_state, pending_state; 874 gst_message_parse_state_changed(msg, &old_state, &new_state, &pending_state); 875 if(GST_MESSAGE_SRC(msg) == GST_OBJECT(pipeline)) 876 { 877 if(new_state == GST_STATE_PLAYING) 878 { 879 /* Once we are in the playing state, analyze the streams */ 880 analyze_streams(data); 881 } 882 } 883 871 884 if(old_state == new_state) break; 872 885 … … 2402 2415 } 2403 2416 2404 #endif 2417 #ifdef EPLAYER4 2418 /* Extract some metadata from the streams and print it on the screen */ 2419 static void analyze_streams(CustomData *data) 2420 { 2421 gint i; 2422 GstTagList *tags; 2423 gchar *str; 2424 guint rate; 2425 2426 /* Read some properties */ 2427 g_object_get(pipeline, "n-video", &data->n_video, NULL); 2428 g_object_get(pipeline, "n-audio", &data->n_audio, NULL); 2429 g_object_get(pipeline, "n-text", &data->n_text, NULL); 2430 2431 g_print("%d video stream(s), %d audio stream(s), %d text stream(s)\n", data->n_video, data->n_audio, data->n_text); 2432 2433 g_print ("\n"); 2434 for(i = 0; i < data->n_video; i++) 2435 { 2436 tags = NULL; 2437 /* Retrieve the stream's video tags */ 2438 g_signal_emit_by_name(pipeline, "get-video-tags", i, &tags); 2439 if(tags) 2440 { 2441 g_print("video stream %d:\n", i); 2442 gst_tag_list_get_string(tags, GST_TAG_VIDEO_CODEC, &str); 2443 g_print(" codec: %s\n", str ? str : "unknown"); 2444 g_free(str); 2445 gst_tag_list_free(tags); 2446 } 2447 } 2448 2449 g_print("\n"); 2450 for(i = 0; i < data->n_audio; i++) 2451 { 2452 tags = NULL; 2453 g_signal_emit_by_name(pipeline, "get-audio-tags", i, &tags); 2454 if(tags) 2455 { 2456 /* Retrieve the stream's audio tags */ 2457 g_print("audio stream %d:\n", i); 2458 if(gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) 2459 { 2460 g_print(" codec: %s\n", str); 2461 g_free(str); 2462 } 2463 if(gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) 2464 { 2465 g_print(" language: %s\n", str); 2466 g_free(str); 2467 } 2468 if(gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)) 2469 { 2470 g_print(" bitrate: %d\n", rate); 2471 } 2472 gst_tag_list_free(tags); 2473 } 2474 } 2475 2476 g_print("\n"); 2477 for(i = 0; i < data->n_text; i++) 2478 { 2479 tags = NULL; 2480 /* Retrieve the stream's subtitle tags */ 2481 g_print("subtitle stream %d:\n", i); 2482 g_signal_emit_by_name(pipeline, "get-text-tags", i, &tags); 2483 if(tags) 2484 { 2485 if(gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) 2486 { 2487 g_print(" language: %s\n", str); 2488 g_free(str); 2489 } 2490 gst_tag_list_free(tags); 2491 } 2492 else 2493 { 2494 g_print(" no tags found\n"); 2495 } 2496 } 2497 2498 g_object_get(pipeline, "current-video", &data->current_video, NULL); 2499 g_object_get(pipeline, "current-audio", &data->current_audio, NULL); 2500 g_object_get(pipeline, "current-text", &data->current_text, NULL); 2501 2502 g_print("\n"); 2503 g_print("Currently playing video stream %d, audio stream %d and subtitle stream %d\n", data->current_video, data->current_audio, data->current_text); 2504 g_print("Type any number and hit ENTER to select a different subtitle stream\n"); 2505 } 2506 #endif 2507 2508 #endif
Note: See TracChangeset
for help on using the changeset viewer.