MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / android_camera_read_header

Function android_camera_read_header

libavdevice/android_camera.c:775–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775static int android_camera_read_header(AVFormatContext *avctx)
776{
777 AndroidCameraCtx *ctx = avctx->priv_data;
778 int ret;
779
780 atomic_init(&ctx->got_image_format, 0);
781 atomic_init(&ctx->exit, 0);
782
783 ret = av_thread_message_queue_alloc(&ctx->input_queue, ctx->input_queue_size, sizeof(AVPacket));
784 if (ret < 0) {
785 av_log(avctx, AV_LOG_ERROR,
786 "Failed to allocate input queue, error: %s.\n", av_err2str(ret));
787 goto error;
788 }
789
790 ctx->camera_mgr = ACameraManager_create();
791 if (!ctx->camera_mgr) {
792 av_log(avctx, AV_LOG_ERROR, "Failed to create Android camera manager.\n");
793 ret = AVERROR_EXTERNAL;
794 goto error;
795 }
796
797 ret = open_camera(avctx);
798 if (ret < 0) {
799 av_log(avctx, AV_LOG_ERROR, "Failed to open camera.\n");
800 goto error;
801 }
802
803 get_sensor_orientation(avctx);
804 match_video_size(avctx);
805 match_framerate(avctx);
806
807 ret = create_image_reader(avctx);
808 if (ret < 0) {
809 goto error;
810 }
811
812 ret = create_capture_session(avctx);
813 if (ret < 0) {
814 goto error;
815 }
816
817 ret = add_video_stream(avctx);
818
819error:
820 if (ret < 0) {
821 android_camera_read_close(avctx);
822 av_log(avctx, AV_LOG_ERROR, "Failed to open android_camera.\n");
823 }
824
825 return ret;
826}
827
828static int android_camera_read_packet(AVFormatContext *avctx, AVPacket *pkt)
829{

Callers

nothing calls this directly

Calls 10

av_logFunction · 0.85
open_cameraFunction · 0.85
get_sensor_orientationFunction · 0.85
match_video_sizeFunction · 0.85
match_framerateFunction · 0.85
create_image_readerFunction · 0.85
create_capture_sessionFunction · 0.85
add_video_streamFunction · 0.85

Tested by

no test coverage detected