void * bg_avdec_create() { avdec_priv * ret = calloc(1, sizeof(*ret)); ret->opt = bgav_options_create(); bgav_options_set_log_callback(ret->opt, log_callback, NULL); return ret; }
ReadMedia::ReadMedia( ) { m_state = STATE_EMPTY; m_audio_frame = NULL; m_video_frame = NULL; m_aeof = true; m_veof = true; //m_atime = 0.0; //m_vtime = 0.0; m_video_stream_count =0; m_audio_stream_count =0; m_pcm_seek = SEEK_NOTHING; m_frame_seek = SEEK_NOTHING; m_length_in_seconds=0.0; m_length_in_gavltime = 0; m_num_frames=0; m_num_samples=0; m_video_format.frame_width=0; m_video_format.frame_height=0; m_video_format.image_width=0; m_video_format.image_height=0; m_video_format.pixel_width=0; m_video_format.pixel_height=0; m_video_format.pixelformat = GAVL_PIXELFORMAT_NONE ; m_video_format.frame_duration=0; m_video_format.timescale=0; m_video_format.framerate_mode=GAVL_FRAMERATE_CONSTANT; m_video_format.chroma_placement=GAVL_CHROMA_PLACEMENT_DEFAULT; m_video_format.interlace_mode=GAVL_INTERLACE_NONE; m_video_format.timecode_format.int_framerate =0; m_video_format.timecode_format.flags =0; m_audio_format.samples_per_frame = 0; m_audio_format.samplerate = 0; m_audio_format.num_channels = 0; m_audio_format.sample_format = GAVL_SAMPLE_NONE ; m_audio_format.interleave_mode = GAVL_INTERLEAVE_NONE; m_audio_format.center_level = 1.0; m_audio_format.rear_level = 1.0; m_audio_format.channel_locations[0] = GAVL_CHID_NONE; // Reset m_fifoaudio= NULL; // new FifoAudioFrames( frames_in_fifo , &tmp_audio_lormat); m_fifovideo= NULL; // new FifoVideoFrames( 12 , &output_video_format); m_audio_thread_ret = -1; m_video_thread_ret = -1; m_open_callback = NULL; m_open_callback_data = NULL; m_buffer_callback = NULL; m_buffer_callback_data = NULL; quit_av_threads = false; m_loop = false; sprintf(m_filename, "seinettbitte!"); //bgav stuff m_file = NULL; m_opt = bgav_options_create(); bgav_options_set_connect_timeout(m_opt, 5000); bgav_options_set_read_timeout(m_opt, 5000); bgav_options_set_network_bandwidth(m_opt, 524300); bgav_options_set_network_buffer_size(m_opt, 1024*12); bgav_options_set_http_shoutcast_metadata (m_opt, 1); // set up the reading so that we can seek sample accurately bgav_options_set_sample_accurate (m_opt, 1 ); pthread_cond_init(&m_cond_dispatch, 0); pthread_mutex_init(&m_condmut_dispatch, 0); pthread_cond_init(&m_cond_a, 0); pthread_cond_init(&m_cond_v, 0); pthread_mutex_init(&m_condmut_a, 0); pthread_mutex_init(&m_condmut_v, 0); pthread_mutex_init(&m_av_mut, 0); pthread_mutex_init(&m_state_mut, 0); // start the dispatcher thread m_cmd = CMD_START; m_dispatcher_thread_ret = pthread_create(&m_thread_dispatch, NULL, the_thread_dispatcher, (void *)this) ; if (m_dispatcher_thread_ret != 0 ) printf("error starting the readmedia dispatcher thread.\n"); while( getCommand() != CMD_NULL) signalDispatcher(); //printf("dispatcher ready ...\n"); }