mike-jumper commented on a change in pull request #159: GUACAMOLE-465: 
beginning to support new codecs and containers
URL: https://github.com/apache/guacamole-server/pull/159#discussion_r371049391
 
 

 ##########
 File path: src/guacenc/video.c
 ##########
 @@ -51,25 +69,35 @@ guacenc_video* guacenc_video_alloc(const char* path, const 
char* codec_name,
         goto fail_codec;
     }
 
+    /* create stream */
+    video_stream = NULL;
+    video_stream = avformat_new_stream(container_format_context, codec);
+    if (video_stream == NULL) {
+        guacenc_log(GUAC_LOG_ERROR, "Could not allocate encoder stream. Cannot 
continue.\n");
+        goto fail_format_context;
+    }
+    video_stream->id = container_format_context->nb_streams - 1;
+
     /* Retrieve encoding context */
-    AVCodecContext* context = avcodec_alloc_context3(codec);
-    if (context == NULL) {
+    AVCodecContext* avcodec_context =
+            guacenc_build_avcodeccontext(video_stream, codec, bitrate, width,
+                    height, /*gop size*/ 10, /*qmax*/ 31, /*qmin*/ 2,
+                    /*pix fmt*/ AV_PIX_FMT_YUV420P,
+                    /*time base*/ (AVRational) { 1, GUACENC_VIDEO_FRAMERATE });
+
+    if (avcodec_context == NULL) {
         guacenc_log(GUAC_LOG_ERROR, "Failed to allocate context for "
                 "codec \"%s\".", codec_name);
         goto fail_context;
     }
 
-    /* Init context with encoding parameters */
-    context->bit_rate = bitrate;
-    context->width = width;
-    context->height = height;
-    context->time_base = (AVRational) { 1, GUACENC_VIDEO_FRAMERATE };
-    context->gop_size = 10;
-    context->max_b_frames = 1;
-    context->pix_fmt = AV_PIX_FMT_YUV420P;
+    //if format needs global headers, write them
 
 Review comment:
   Single-line comments within guacamole-server should be C-style (`/* ... */`) 
rather than C++-style (`// ...`).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to